TabU.java 94 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077
  1. package ss.page;
  2. import java.util.HashMap;
  3. import java.util.LinkedList;
  4. import java.util.List;
  5. import java.util.Map;
  6. import jakarta.servlet.http.HttpServletRequest;
  7. import jakarta.servlet.jsp.JspException;
  8. import jakarta.servlet.jsp.PageContext;
  9. import com.google.gson.Gson;
  10. import org.apache.commons.lang3.StringUtils;
  11. import org.apache.logging.log4j.LogManager;
  12. import org.apache.logging.log4j.Logger;
  13. import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;
  14. import ss.db.Db;
  15. import ss.db.SqlCmd;
  16. import ss.form.FormC;
  17. import ss.search.SearchC;
  18. import ss.skin.SkinC;
  19. import ss.user.UserU;
  20. import ss.WebC;
  21. import ss.log.SsLog;
  22. import ss.obj.ObjB;
  23. import ss.obj.ObjChildB;
  24. import ss.obj.ObjC;
  25. import ss.obj.ObjFuncB;
  26. import ss.obj.ObjU;
  27. public class TabU {
  28. // 增加,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
  29. private static final Logger log4j = LogManager.getLogger(TabU.class);
  30. // 来自 TabTag.(int) doStartTag()。Lin
  31. // 增加 name(String)、pageContext(PageContext),从 TabTag 抽取出来了 -- 支持服务调用,支持小程序
  32. // name = this.name,this = TabTag
  33. // pageContext = super.pageContext,super = TagSupport
  34. // 去掉返回值,在上层返回
  35. public static void doTabTag(String name, PageContext pageContext) {
  36. // Db wdgdba = null; // 再去掉,移到下面用到的地方 -- 里层的 try-catch 里。Lin
  37. try { // 最外层的 try-catch,不用管 wdgdba 的关闭了(finally {})。Lin
  38. HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); // super.pageContext.。改为入口参数了。Lin
  39. // String appName = WdLoginUtil.getLoginedAppName(request); // 去掉 appName,不支持多个应用。Lin
  40. /* value 改用 Json 写法。Lin
  41. Map<String, String> tabValue = ViewObjectUtil.parseTabValue(value == null ? null : value.toString());
  42. */
  43. /* 再改,用回 ViewObjectUtil.parseTabValue( > TabU.rdTabVal(。Lin
  44. Map<String, String> tabValue = StrJson.toMap((this.val == null)? null : this.val.toString());
  45. */
  46. /* 再改回:val 里的内容,都用 Json 写法 -- 包括数组形式。Lin
  47. * "include_input"/"editBaseInfo,child" 改为 "{val:'include_input'}"/"{val:'editBaseInfo,child'}"
  48. * 去掉 TabU.rdTabVal( 了。Lin
  49. Map<String, String> tabValue = TabU.rdTabVal((this.val == null)? null : this.val.toString());
  50. */
  51. /* 再去掉 StrJson.toMap(,直接用 Gson.fromJson(jsonStr, new TypeToken<Map<String, String>>() {}.getType())。Lin
  52. * 注意:rdTabVal() 不会返回 null。(返回 new HashMap<>()
  53. Map<String, String> tabValue = StrJson.toMap((this.val == null)? null : this.val.toString());
  54. */
  55. /* 再改,拆分 val= 里的内容。Lin
  56. * val='{val:"tagState"}' 改为 name = "tagState"
  57. * val='{val:"baseInfo,child"}' 改为 name="baseInfo,child" -- 简写,不用 Json 格式
  58. * val='{enable:"viewobject.funcMap.play.print",value:"print"}' 改为
  59. * name="print" 和 enable="viewobject.funcMap.play.print"
  60. * val='{show:"button",dest:"env_printInfo",enable:"viewobject.funsMap.change.print",from:"print"}' 改为
  61. * name="prt" filter="viewobject.funsMap.change.print" btn="true" dest="env_printInfo"
  62. * 合成 tabValue(Map<String, String>),为了 TabU.cmptTab( 的入口参数。Lin
  63. * 属性已经拆分在 this.name、this.enable、this.show、this.dest 里了
  64. * 再去掉 <data.ss name="prt" 里的 btn="true",直接写 <jsp.ss file="/ss/prtIcon.jsp"/>
  65. Map<String, String> tabValue = new Gson().fromJson((this.val == null)? null : this.val.toString(),
  66. new TypeToken<Map<String, String>>(){}.getType());
  67. if (tabValue == null) // 增加,TabU.rdTabVal() 不会返回 null。Lin
  68. tabValue = new HashMap<>();
  69. */
  70. /* 再去掉 <data.ss name="prt" 里的 btn="true",直接写 <jsp.ss file="/ss/prtIcon.jsp"/>。Lin
  71. * 再去掉 enable(String) 和 dest(String),只有 <data.ss name="prt"/> 了
  72. * enable:,值来自 <func print="true" -- 页面实际上是根据 "prt" <func 去过滤
  73. * 用 dest(env_printInfo.jsp) 替换 from <func 里的 .dest -- 不用 env_printInfo.jsp,共用 env_print.jsp
  74. Map<String, String> tabValue = TabU.combTabVal(this.name, this.filter, this.show, this.dest);
  75. */
  76. /* 再改,去掉 TabU.combTabVal(String name),直接写 Map.of("name", this.name)。Lin
  77. * TabTag 和 DataTag 共用,DataTag 不能调用 TabU
  78. * 调用 TabU.combTabVal( 时的 name 不会为空
  79. * 只有一句 Map.put("name", name) 了
  80. Map<String, String> tabValue = TabU.combTabVal(this.name);
  81. */ Map<String, String> tabValue = Map.of("name", name); // (this.name)。改为入口参数了。Lin
  82. /* 再改,拆分 val= 里的内容。Lin
  83. String value = tabValue.get("val"); // "value")。Lin
  84. */
  85. /* 再去掉,直接用 this.name。Lin
  86. String value = this.name;
  87. */
  88. /* 再改,拆分 val= 里的内容。Lin
  89. String dest = tabValue.get("dest");
  90. */
  91. /* 再去掉,<data.ss name="prt"/> 没有 dest 参数了。Lin
  92. String dest = this.dest;
  93. */
  94. /* 改。-- 晕。Lin
  95. * TheTag.findViewObjectFromToken() >
  96. * TheTag.findViewObjectFromRequest(appName, request) >
  97. * ViewObjectUtil.findViewObjectFromRequest(appName, request)
  98. ViewObject viewobj = findViewObjectFromToken();
  99. */ ObjB viewobj = ObjU.rdObjByReq(request);
  100. if (viewobj == null)
  101. throw new Exception("<tab.ss 查找对象失败:"+ name); // + this.name)。改为入口参数了。Lin
  102. Map<String, Object> wholeMap = new HashMap<>();
  103. /* 再改,去掉 .idField(ObjFieldB),直接用新加的 ObjB.idName(String)。Lin
  104. String idName = viewobj.idField.name; // .getObjectIdField().getName().toLowerCase()。不需要 .toLowerCase()。Lin
  105. */
  106. /* 再去掉,去掉 idName,直接用 viewobj.idName。Lin
  107. String idName = viewobj.idName; // .getObjectIdField().getName().toLowerCase()。不需要 .toLowerCase()。Lin
  108. */
  109. ///// 改,不写 request."dxid",已有值了 -- 有问题再改。Lin
  110. // 从 Request 获取 dxid
  111. // 再,不能去掉,从草稿箱进入录入界面时,request."dxid" 没有值
  112. String dxid;
  113. /* 改。Lin
  114. * 去掉 idName,直接用 viewobj.idName
  115. * 原 pageContext 为 super.pageContext.,改为入口参数了
  116. dxid = (String) ExpressionEvaluatorManager.evaluate("", "${" + idName + "}", String.class, pageContext);
  117. */ dxid = (String) ExpressionEvaluatorManager.evaluate("", "${"+ viewobj.idName +"}", String.class, pageContext);
  118. /// 再增加,再从 request 里取 -- 支持小程序。Lin
  119. // 异步加载数据时,不是 JSP 的页面标签,取不到页面里的属性值
  120. if (StringUtils.isBlank(dxid))
  121. dxid = String.valueOf(request.getAttribute(WebC.REQ_objId)); // 一定有值,不会输出 "null" 串。Lin
  122. ///
  123. if (StringUtils.isNotBlank(dxid)) { // StringUtil.notNull()。Lin
  124. /* 再改为 "ssObjId",避免与数据表里的 对象ID 字段重名 -- 导致合并 Map 时,因 Key 同名而互相覆盖 Value。Lin
  125. request.setAttribute("dxid", dxid);
  126. */ request.setAttribute(WebC.REQ_objId, dxid);
  127. /// 再增加,写 request."ssObjName" -- 从草稿箱进入修改界面时,TabServ.wrTabStateByA() 取不到 request."ssObjName" -- 重写了小圆点的方法。Lin
  128. request.setAttribute(WebC.REQ_objName, viewobj.name);
  129. ///
  130. }
  131. /////
  132. wholeMap.put(ObjC.WHOLE_MAP_REQUEST, request); // ViewObjectUtil.WHOLE_MAP_REQUEST。Lin
  133. /// 说明:对于 "enable:viewobject.funcMap.play.print,value:print",此判断条件成立 -- value 为 "print"。Lin
  134. /// 下一个分支条件 else if (StringUtils.isNotBlank(dest)) 不成立 -- dest 为空
  135. /// 对于 "show:button,dest:env_printInfo,enable:viewobject.funsMap.change.print,from:print",此判断条件不成立 -- value 为空
  136. /// 下一个分支条件 else if (StringUtils.isNotBlank(dest)) 成立 -- dest 为 "env_printInfo"
  137. /* 再去掉,在前面判断了 -- 只有 <tab.ss name= /> 了 -- name= 不能为空。Lin
  138. if (StringUtils.isNotBlank(value)) { // StringUtil.notNull()。Lin
  139. */
  140. /* 去掉,直接用里面的内容。Lin
  141. receiveBeanMap(wholeMap,viewobj);
  142. */
  143. /* 再改,从草稿箱进入,<tab.ss name="editBaseInfo,child"/> 时,只有 Request."dwid" -- 没有别的 对象字段值 -- objEdit.ss.jsp。Lin
  144. * DbU.rdPoMapByReq( 只返回 Map."dwid"
  145. * TabTag 里的选项卡过滤,需要用到 dwlbm -- 调用 TabU.cmptTab( -- <obj name="dw" child="[{name:'dwzgz',filter:{dwlbm:[5050,5060,5070]}},
  146. * 增加 ObjB.tabFilterFieldNameSet(Set<String>) -- 增加 fieldNameSet(Set<String>),以提高性能
  147. * 增加输出新 UI 左侧栏的 保存并提交 按钮,需要用到 jlztm
  148. * 增加 viewobj.subpageFieldName 键值对 -- 支持一级对象的细分部件
  149. * 点击一级对象的查看,会 3 次进入到 ObjU.makeFuncMap( 里的
  150. * String val = String.valueOf(thisBean.get(obj.subpageKeyName));
  151. * ObjPageB pp = obj.pageMap.get(val);
  152. * dest = toSubpageName(dest, pp.name);
  153. * 第 3 次时,因 thisBean.get(obj.subpageKeyName) 取不到值而抛出空指针
  154. wholeMap.put(ObjC.WHOLE_MAP_THIS_BEAN_MAP, DbU.rdPoMapByReq(viewobj, request));
  155. */
  156. ///// Start。Lin
  157. int jlztm;
  158. Map<String, Object> poMap = new HashMap<>();
  159. /* 再去掉,去掉 objIdStr,用上面的 dxid(String) -- 增加 > 保存 后,request.getParameter(viewobj.idName) 取不到 -- 从 草稿箱 进入,能取到。Lin
  160. String objIdStr = request.getParameter(viewobj.idName);
  161. */
  162. poMap.put(viewobj.idName, dxid); // , objIdStr)。Lin
  163. String sql = "select JLZTM";
  164. /// 再增加,支持一级对象的细分部件的查看。Lin
  165. if (viewobj.subpageKeyName != null)
  166. sql += ","+ viewobj.subpageKeyName;
  167. ///
  168. if (viewobj.tabFilterFieldNameSet != null) // 有 <obj name="dw" child="[{name:'dwzgz',filter:{dwlbm:[5050,5060,5070]}},。Lin
  169. sql += ","+ String.join(",", viewobj.tabFilterFieldNameSet);
  170. sql += " from "+ viewobj.tabName +" where "+ viewobj.idName +"="+ dxid; // + objIdStr。Lin
  171. try (Db gdba = Db.makeConn()) {
  172. gdba.doSel(sql);
  173. jlztm = gdba.rdIntCol("jlztm");
  174. /// 再增加,支持一级对象的细分部件的查看。Lin
  175. if (viewobj.subpageKeyName != null)
  176. poMap.put(viewobj.subpageKeyName, gdba.rdIntCol(viewobj.subpageKeyName));
  177. ///
  178. if (viewobj.tabFilterFieldNameSet != null) { // 有 <obj name="dw" child="[{name:'dwzgz',filter:{dwlbm:[5050,5060,5070]}},。Lin
  179. for (String fieldName : viewobj.tabFilterFieldNameSet) {
  180. poMap.put(fieldName, gdba.rdStrCol(fieldName));
  181. }
  182. }
  183. }
  184. wholeMap.put(ObjC.WHOLE_MAP_THIS_BEAN_MAP, poMap);
  185. ///// End。Lin
  186. /* 去掉,移到下面 -- 对 "include_",没用到。Lin
  187. wdgdba = Db.makeConn(); // GeneralDBAccess.getInstance("jdbc/wd")。Lin
  188. */
  189. // 查找部件
  190. /* 再去掉,移到 DataTag 了 -- <data.ss name="inp"/>。Lin
  191. if (value.startsWith("include_")) {
  192. /// * 去掉,直接用里面的内容。Lin
  193. // wholeMap.put(ViewObjectUtil.WHOLE_MAP_THISFUNCTION, findViewObjectFunctionFromRequest(viewobj, request));
  194. /// *
  195. wholeMap.put(ObjC.WHOLE_MAP_THISFUNCTION, ObjU.rdFuncByReq(request, viewobj));
  196. String bjid = null;
  197. if (TagC.TAB_includeInp.equals(value)) // "include_input")。Lin
  198. bjid = ObjU.rdInpPageName(viewobj, wholeMap); // 去掉 xmmc、wdgdba。Lin
  199. // else if (order.equals("include_baseInfo")) {
  200. // bjid = ViewObjectUtil.findDest_baseInfo(viewobj, appName,
  201. // wdgdba);
  202. // } else if (order.equals("include_miniInfo")) {
  203. // bjid = ViewObjectUtil.findDest_miniInfo(viewobj, appName,
  204. // wdgdba);
  205. // }
  206. if (bjid != null) {
  207. if (StringUtils.isBlank(dxid) // StringUtil.isNull()。Lin
  208. && wholeMap.get(ObjC.WHOLE_MAP_PLUGIN_KEY_MAP) != null) { // ViewObjectUtil.。Lin
  209. Map<String, String> keymap = (Map<String, String>)
  210. wholeMap.get(ObjC.WHOLE_MAP_PLUGIN_KEY_MAP); // "pluginkeymap"。Lin
  211. for (Entry<String, String> entry : keymap.entrySet()) {
  212. super.pageContext.getOut().write("<input type=\"hidden\" name=\""+ entry.getKey()
  213. + "\" value=\""+ entry.getValue() +"\"/>");
  214. }
  215. }
  216. //inlcude dest
  217. ServTagB token; // UrlEntry。Lin
  218. String tokenstr = request.getParameter(ServC.REQ_token); // "token"。Lin
  219. if (tokenstr != null
  220. &&(token = TokenU.rdServTag(tokenstr)) != null){ // TokenMap.getUrl()。Lin
  221. if(token.runParmMap == null) // .getRunningCondition()。Lin
  222. token.runParmMap = new HashMap<>(); // .setRunningCondition()。Lin
  223. /// * 改。Lin
  224. // token.getRunningCondition().put(UrlEntry.RUNNING_CONDITION_INCLUDE_PAGE,bjid);
  225. /// *
  226. token.runParmMap.put(ServC.RUNNING_includePage, bjid);
  227. }
  228. /// * 改。Lin
  229. // pageContext.setAttribute(value, WebUtil.getDefaultComponetPath(bjid,appName));
  230. /// *
  231. /// * 再分开 cmptPageFileName( 和 cmptPagePath(。Lin
  232. // super.pageContext.setAttribute(value, PageU.cmptPageFileName(bjid));
  233. /// *
  234. super.pageContext.setAttribute(value, PageU.cmptPagePath(bjid));
  235. } else {
  236. request.setAttribute(ServC.REQ_msg, viewobj.name +" not found "+ value); // ("msg",。Lin
  237. super.pageContext.setAttribute(value, WebC.PPATH_result); // "/wd/page/rs.jsp"。Lin
  238. }
  239. return SKIP_BODY; // 靠 finally 去关闭 wdgdba。Lin // 再,没用到 wdgdba。Lin
  240. }
  241. */
  242. // 计算tag状态
  243. /* 再去掉,改为 <jsp.ss file="/ss/tabState.jsp"/> 了。Lin
  244. if (TagC.TAB_state.equals(value)) // TabTag.VALUE_TAGSTATE。Lin
  245. return SKIP_BODY; // 靠 finally 去关闭 wdgdba。Lin
  246. */
  247. /* 再去掉,移到 DataTag 了 -- <data.ss name="miniInfo"/> + <jsp.ss file="/ss/miniInfo.jsp"/>。Lin
  248. if (TagC.TAB_miniInfo.equals(value)) { // TabTag.VALUE_PREVIEW。Lin
  249. // GeneralDBAccess gdba = null; // 去掉,用 wdgdba -- 去掉 WD 数据库了。Lin
  250. /// * 再改用 'try' with resources。Lin
  251. // try {
  252. /// *
  253. try (Db wdgdba = Db.makeConn()) {
  254. /// * 去掉,用 wdgdba -- 去掉 WD 数据库了。Lin
  255. // gdba = GeneralDBAccess.getInstance(CoreConstVars.DB_JNDI_NAME_NNDX)。Lin
  256. /// *
  257. /// * 再用 'try' with resources,移到本层的 try 里。Lin
  258. // wdgdba = Db.makeConn(); // 增加,从上面移下来 -- 对 "include_",没用到。Lin
  259. /// *
  260. /// * 改。Lin
  261. // BaseBean bean = (BaseBean) Class.forName(viewobj.getObjClass()).newInstance();
  262. /// *
  263. /// * 再移到 else 里 -- 为了改用 Db.selPoById(。Lin
  264. // Po bean = (Po) Class.forName(viewobj.clazzName).getDeclaredConstructor().newInstance();
  265. /// *
  266. Po bean;
  267. String id = request.getParameter(idName);
  268. /// 增加,selChgInfo 服务里,增加了 request.setAttribute(ServC.SERV_obj, 和 request.setAttribute(idName,。Lin
  269. // 为了 childChgInfo.ss.jsp 与 chgList.ss.jsp 共用 selChgInfo 服务
  270. if (StringUtils.isBlank(id))
  271. id = String.valueOf(request.getAttribute(idName));
  272. ///
  273. if (StringUtils.isBlank(id)) { // StringUtil.isNull()。Lin
  274. bean = DbU.rdPoByReq(viewobj, request); // ViewObjectUtil.findBeanFromRequest()。Lin
  275. } else {
  276. /// * 再改用 Db.selPoById(。Lin
  277. // bean = (Po) Class.forName(viewobj.clazzName).getDeclaredConstructor().newInstance();
  278. // // 移到这里 -- 为了改用 Db.selPoById(。Lin
  279. // bean.wrIdVal(Long.valueOf(id)); // .setDbObjectId()。Lin
  280. // wdgdba.doSelByPo(bean); // gdba.。去掉,用 wdgdba -- 去掉 WD 数据库了。Lin
  281. /// *
  282. /// * 再,.poName 改为 .poClazz。Lin
  283. // bean = wdgdba.selPoById(Long.valueOf(id), (Class<Po>) Class.forName(viewobj.poName));
  284. /// *
  285. bean = wdgdba.selPoById(Long.parseLong(id), viewobj.poClazz);
  286. }
  287. List<Map<String, Object>> objectList = new ArrayList<>();
  288. /// * 去掉 gdba,去掉 WD 数据库了。Lin
  289. // objectList.add(ViewObjectUtil.getPreviewData(viewobj, bean, request, gdba, wdgdba));
  290. /// *
  291. objectList.add(ObjU.rdMiniInfoData(viewobj, bean, request, wdgdba));
  292. request.setAttribute("objectList", objectList);
  293. /// * 去掉 appName,不支持多个应用。Lin
  294. // * 不知哪里用到,搞明白再改???
  295. // * 另,TabTagComper 里,有用到 pms/clip/miniInfo.jsp -- 就是此 source.jsp,复制自同目录下的 init.jsp
  296. // pageContext.setAttribute("preview_includeJsp", "/main/sheji/object/preview/" + appName + "/source.jsp");
  297. /// *
  298. super.pageContext.setAttribute("preview_includeJsp", "/main/sheji/object/preview/source.jsp");
  299. } catch (Exception e) {
  300. /// * 再去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
  301. // e.printStackTrace();
  302. /// *
  303. log4j.error("TabTag.doStartTag() 异常", e);
  304. ///// * 再改,IDEA:Empty 'finally' block。Lin
  305. // * 改用 'try' with resources -- 自动关闭 wdgdba
  306. // } finally {
  307. /// * 去掉,去掉 gdba 了。Lin
  308. // if (gdba != null)
  309. // gdba.close();
  310. /// *
  311. ///// *
  312. }
  313. return SKIP_BODY; // 靠 finally 去关闭 wdgdba。Lin
  314. }
  315. */
  316. /* 再抽取到 TabU.makeTokenParm(,和 DataTag 共用 -- 增加 DataTag 了。Lin
  317. * 去掉 idName,直接用 viewobj.idName
  318. * super.pageContext 改为 pageContext,改为入口参数了
  319. Map<String, String> tokenParam = new HashMap<>();
  320. tokenParam.put(idName, dxid);
  321. tokenParam.put("dxid", dxid);
  322. tokenParam.put("dxm", viewobj.name);
  323. tokenParam.put("sqid", (String) ExpressionEvaluatorManager
  324. .evaluate("", "${sqid}", String.class, super.pageContext));
  325. tokenParam.put("shid", (String) ExpressionEvaluatorManager
  326. .evaluate("", "${shid}", String.class, super.pageContext));
  327. tokenParam.put("dataType", (String) ExpressionEvaluatorManager
  328. .evaluate("", "${dataType}", String.class, super.pageContext));
  329. /// * 改,if 条件里不用再取一次。Lin
  330. // * IDEA 规范 -- Condition 'request != null' is always 'true'
  331. // if (request != null && request.getParameter(ViewObjectUtil.REQUEST_PARENT_VIEWOBJECT) != null){
  332. // String pName=request.getParameter(ViewObjectUtil.REQUEST_PARENT_VIEWOBJECT);
  333. // tokenParam.put(ViewObjectUtil.REQUEST_PARENT_VIEWOBJECT,pName);
  334. /// *
  335. String pName = request.getParameter(WebC.REQ_pobjName); // 从 if 里移上来。Lin
  336. if (pName != null) {
  337. tokenParam.put(WebC.REQ_pobjName, pName);
  338. /// * 改。Lin
  339. // Field pf= ViewObjectUtil.getParentIdField(viewobj,pName);
  340. /// *
  341. ObjFieldB pf= ObjU.rdParentIdField(viewobj, pName);
  342. if (pf != null && request.getParameter(pf.name) != null){
  343. tokenParam.put(pf.name,request.getParameter(pf.name));
  344. }
  345. }
  346. */ Map<String, String> tokenParam = TabU.makeTokenParm(viewobj, viewobj.idName, dxid, pageContext, request);
  347. wholeMap.put(ObjC.WHOLE_MAP_TOKEN, tokenParam); // ViewObjectUtil.WHOLE_MAP_TOKEN。Lin
  348. Map<String, Object> permission = new HashMap<>();
  349. /* 再把 findJlztm(viewobj) 移到 TabU.rdJlztm(,与 DataTag 共用 -- 增加 DataTag 了。Lin
  350. * 增加 pageContext(PageContext),从 TabTag 移出来了
  351. permission.put("jlztm", findJlztm(viewobj));
  352. */
  353. /* 再改,增加 jlztm(int) 了 -- 增加输出新 UI 左侧栏的 保存并提交 按钮,需要用到 jlztm。Lin
  354. permission.put("jlztm", TabU.rdJlztm(viewobj, super.pageContext));
  355. */ permission.put("jlztm", jlztm);
  356. permission.put("request", request);
  357. /* 去掉 xmmc、wdgdba。Lin
  358. CalculateTabResult ct = ViewObjectUtil
  359. .calculateTab(appName, viewobj, tabValue, true, wholeMap, permission, wdgdba, false);
  360. */
  361. /* 再去掉 true = isRunning(boolean),没用到,IDEA。Lin
  362. TabB ct = TabU.cmptTab(viewobj, tabValue, true, wholeMap, permission, false);
  363. // true = isRunning,false = isMobile111。Lin
  364. */ TabRunB ct = cmptTab(viewobj, tabValue, wholeMap, permission, false); // false = isMobile111。Lin
  365. /// 再增加,显示错误信息到页面 -- 点击待办,打开的办理页里,没有相应的服务授权会导致局部空白 -- 没有 miniInfo,没有 同意、退回 按钮 -- 不显示 服务名,后台有显示。Lin
  366. if (ct.noAuth) {
  367. pageContext.getResponse().getWriter().write("<span style=\"color: red;\">*** 没有服务授权 ***</span>"); // super.pageContext.。改为入口参数了。Lin
  368. return; // return SKIP_BODY。去掉返回值,在上层返回。Lin
  369. }
  370. ///
  371. ///// 再增加,增加输出新 UI 左侧栏的 保存并提交 按钮 -- 抄自 InpServ.initInp()。Lin
  372. // 上面已经写了 wholeMap."request" 和 wholeMap."thisbeanmap"
  373. // wholeMap."thisbeanmap" 里的字段值只有 dwid、jlztm -- 不够再加
  374. // 对 Box,新 UI 左侧栏没有 保存并提交 按钮
  375. /* 再去掉,改为 遥控器 了 -- 遥控原来的 基本情况 选项卡里的 保存并提交 按钮。Lin
  376. if (!viewobj.isBox) {
  377. Map<String, String> param = new HashMap<>();
  378. param.put(viewobj.idName, dxid); // , objIdStr)。Lin
  379. param.put(ServC.SERV_obj, viewobj.name); // "thisViewObject",。Lin
  380. ObjFuncB fn;
  381. if (jlztm == ObjC.JLZT_inEdit)
  382. fn = viewobj.funcMap.get(ObjC.FUNC_submAddName);
  383. else
  384. fn = viewobj.funcMap.get(ObjC.FUNC_submChgName);
  385. wholeMap.put(ObjC.WHOLE_MAP_THISFUNCTION, fn); // "thisfunction"。Lin
  386. /// 再增加,不在页面混写 -- 只能从页面取 ${dataType}。Lin
  387. // 在 objEdit.ss.jsp 里写 pageContext.setAttribute("dataType","update")
  388. // 在 objChg.ss.jsp 里写 pageContext.setAttribute("dataType","change")
  389. // 在调用本方法前,把 dataType:(保存并提交) 写到 param 里 -- 不在页面转一圈
  390. // 原 objInp.ss.jsp 里 parm="{${saveAndCommitParam},dataType:&quot;${empty dataType?1:dataType}&quot;}"
  391. String dataType = (String) ExpressionEvaluatorManager
  392. .evaluate("", "${dataType}", String.class, super.pageContext);
  393. param.put(ObjC.CHILD_type, dataType);
  394. ///
  395. ObjU.wrBtnParmByReq(fn, InpC.PARM_submAddPre, viewobj, param, wholeMap, request);
  396. }
  397. */
  398. /////
  399. if (ct.reqName != null) {
  400. /* 再改,IDEA:'ct.funcMap.size() > 0' can be replaced with '!ct.funcMap.isEmpty()'。Lin
  401. if (ct.funcMap.size() > 0)
  402. */ if (!(ct.funcAtrMap.isEmpty())) {
  403. pageContext.setAttribute(ct.reqName, ct.funcAtrMap); // super.pageContext.。改为入口参数了。Lin
  404. /// 再增加,写到 request,ServS 里会转为 json 并 writer.write( -- 支持小程序。Lin
  405. request.setAttribute(ct.reqName, ct.funcAtrMap);
  406. ///
  407. }
  408. } else {
  409. pageContext.setAttribute("tabHeight", "{minHeight:"+ ct.minHeight +",maxHeight:"+ ct.maxHeight +"}"); // super.pageContext.。改为入口参数了。Lin
  410. /// 再增加,写到 request,ServS 里会转为 json 并 writer.write( -- 支持小程序。Lin
  411. request.setAttribute("tabHeight", "{minHeight:"+ ct.minHeight +",maxHeight:"+ ct.maxHeight +"}");
  412. ///
  413. ///// 增加,临时解决页面混写。Lin
  414. // chgChkTab.ss.jsp: ${item.param},bdlbm:,encode_shid:...
  415. // 在 TabB.tabList(List<Map<String, Object>>) 的 Map 里,增加 "paramStr"
  416. // 把 "param" 转为 Json 串,并去掉左、右 "{"、"}"
  417. // 另,增加 删除二级对象的基本情况变动 功能,objChg.ss.jsp 里,也用上了 "paramStr"
  418. // 混写了 bdlbm 和 sqid -- 续传 bdlbm 和 sqid 到 InpServ.initInp()
  419. // 再增加,对变动功能(<func name="chgBaseInfo"),"desc" 改为 <func name="baseInfo" 的("基本情况")
  420. // Gson gson = new Gson(); // 再去掉,没用到了。Lin
  421. /* 再改,去掉 map."paramStr" -- 不在页面混写。Lin
  422. * 先临时用拼接字符串方法,重写 PageU.rdFithParmByHtml(、TabU.cmptTab( 等时再弄彻底 -- !!!打开变动审核页,调用了 64 次 TabU.cmptTab( !!!
  423. * 不拼接 sqid:,原 map."param" 已有
  424. * 去掉 StringEscapeUtils.unescapeJava(,没有作用
  425. for (Map<String, Object> map : ct.tabList) {
  426. for (Entry<String, Object> e : map.entrySet()) {
  427. if ("param".equals(e.getKey())) {
  428. /// * 再改,去掉 gson.toJson(,e.getValue() 已是 Json 串。Lin
  429. // String paramStr = StringEscapeUtils.unescapeJava(gson.toJson(e.getValue()));
  430. // paramStr = paramStr.substring(2, paramStr.length() -2); // 转出来的是 "{...}"。Lin
  431. /// *
  432. String paramStr = StringEscapeUtils.unescapeJava(String.valueOf(e.getValue()));
  433. paramStr = paramStr.substring(1, paramStr.length() -1); // 转出来的是 {...}。Lin
  434. map.put("paramStr", paramStr);
  435. break;
  436. }
  437. }
  438. */
  439. String bdlbm = (String) ExpressionEvaluatorManager
  440. .evaluate("", "${bdlbm}", String.class, pageContext); // , super.pageContext)。改为入口参数了。Lin
  441. /// 再增加,再从 request 里取 -- 支持小程序。Lin
  442. // 异步加载数据时,不是 JSP 的页面标签,取不到页面里的属性值
  443. if (StringUtils.isBlank(bdlbm)) {
  444. Object val = request.getAttribute("bdlbm");
  445. bdlbm = (val == null)? null : String.valueOf(val);
  446. }
  447. ///
  448. // String sqid = (String) ExpressionEvaluatorManager
  449. // .evaluate("", "${sqid}", String.class, super.pageContext);
  450. String encode_shid = (String) ExpressionEvaluatorManager
  451. .evaluate("", "${encode_shid}", String.class, pageContext); // , super.pageContext)。改为入口参数了。Lin
  452. /// 再增加,再从 request 里取 -- 支持小程序。Lin
  453. // 异步加载数据时,不是 JSP 的页面标签,取不到页面里的属性值
  454. if (StringUtils.isBlank(encode_shid)) {
  455. Object val = request.getAttribute("encode_shid");
  456. encode_shid = (val == null)? null : String.valueOf(val);
  457. }
  458. ///
  459. for (Map<String, Object> map : ct.tabList) {
  460. for (Map.Entry<String, Object> e : map.entrySet()) {
  461. if ("param".equals(e.getKey())) {
  462. String paramStr = ((String) e.getValue());
  463. paramStr = StringUtils.substringBeforeLast(paramStr, "}");
  464. if (StringUtils.isNotBlank(bdlbm))
  465. paramStr += ",bdlbm:"+ bdlbm;
  466. // if (StringUtils.isNotBlank(sqid))
  467. // paramStr += ",sqid:"+ sqid;
  468. if (StringUtils.isNotBlank(encode_shid))
  469. paramStr += ",encode_shid:"+ encode_shid;
  470. paramStr += "}";
  471. map.put("param", paramStr);
  472. break;
  473. }
  474. }
  475. /// 再增加,解决 "基本情况" 选项卡显示为 "变动"/"修改"。Lin
  476. // 对 <func name="chgBaseInfo"/"editBaseInfo","desc" 改为用 <func name="baseInfo" 的
  477. // 原 <func 里的 desc=/playDesc=,同时也是变动/修改界面的 选项卡 名称
  478. String funcName = (String) map.get("name");
  479. if (ObjC.FUNC_chgBaseInfoName.equals(funcName) ||
  480. ObjC.FUNC_editBaseInfoName.equals(funcName)) {
  481. ObjFuncB baseInfoFunc = viewobj.funcMap.get(ObjC.FUNC_baseInfoName); // 基本情况 <func。Lin
  482. if (baseInfoFunc != null)
  483. map.put("desc", baseInfoFunc.playDesc);
  484. }
  485. ///
  486. }
  487. /////
  488. pageContext.setAttribute("tabList", ct.tabList); // super.pageContext.。改为入口参数了。Lin
  489. /// 再增加,写到 request,ServS 里会转为 json 并 writer.write( -- 支持小程序。Lin
  490. request.setAttribute("tabList", ct.tabList);
  491. ///
  492. }
  493. /* 再去掉,在前面判断了 -- 只有 <tab.ss name= /> 了 -- name= 不能为空。Lin
  494. * 再去掉,只有 <tab.ss name= /> 了 -- 移到 DataTag 了 -- 改为 <data.ss name="prt"/> 了
  495. } else if (StringUtils.isNotBlank(dest)) { // StringUtil.notNull()。Lin
  496. /// * 改。Lin
  497. // wdgdba = GeneralDBAccess.getInstance("jdbc/wd");
  498. /// *
  499. /// * 再去掉,没用到了 -- TabU.cmptTab( 去掉 gdba 入口参数了。Lin
  500. // wdgdba = Db.makeConn();
  501. /// *
  502. /// * 去掉 receiveBeanMap(),直接把内容移到这。Lin
  503. // receiveBeanMap(wholeMap,viewobj);
  504. /// *
  505. wholeMap.put(ObjC.WHOLE_MAP_THIS_BEAN_MAP, DbU.rdPoMapByReq(viewobj, request));
  506. Map<String, String> tokenParam = new HashMap<>();
  507. tokenParam.put(idName, dxid);
  508. tokenParam.put("dxid", dxid);
  509. tokenParam.put("dxm", viewobj.name);
  510. tokenParam.put("sqid", (String) ExpressionEvaluatorManager
  511. .evaluate("", "${sqid}", String.class, super.pageContext));
  512. tokenParam.put("shid", (String) ExpressionEvaluatorManager
  513. .evaluate("", "${shid}", String.class, super.pageContext));
  514. tokenParam.put("dataType", (String) ExpressionEvaluatorManager
  515. .evaluate("", "${dataType}", String.class, super.pageContext));
  516. Map<String, Object> permission = new HashMap<>();
  517. permission.put("jlztm", findJlztm(viewobj));
  518. permission.put("request", request);
  519. wholeMap.put(ObjC.WHOLE_MAP_TOKEN, tokenParam); // ViewObjectUtil.WHOLE_MAP_TOKEN。Lin
  520. /// * 去掉 xmmc、wdgdba。Lin
  521. // CalculateTabResult ct = ViewObjectUtil
  522. // .calculateTab(appName, viewobj, tabValue, true, wholeMap, permission, wdgdba, false);
  523. /// *
  524. /// * 再去掉 true = isRunning(boolean),没用到,IDEA。Lin
  525. // TabB ct = TabU.cmptTab(viewobj, tabValue, true, wholeMap, permission, false);
  526. // // true = isRunning,false = isMobile111。Lin
  527. /// *
  528. TabRunB ct = TabU.cmptTab(viewobj, tabValue, wholeMap, permission, false);
  529. // false = isMobile111。Lin
  530. //noinspection DataFlowIssue
  531. if (ct.reqName != null) {
  532. /// * 再改,IDEA:'ct.funcMap.size() > 0' can be replaced with '!ct.funcMap.isEmpty()'。Lin
  533. // if (ct.funcMap.size() > 0)
  534. /// *
  535. if (!(ct.funcAtrMap.isEmpty()))
  536. super.pageContext.setAttribute(ct.reqName, ct.funcAtrMap);
  537. }
  538. }else if (StringUtils.isBlank(value)) { // StringUtil.isNull()。Lin
  539. request.setAttribute("dxm", viewobj.name);
  540. request.setAttribute("dxidName", idName);
  541. /// * 改,肯定 request != null 了。Lin
  542. // if (request != null && request.getParameter(ViewObjectUtil.REQUEST_PARENT_VIEWOBJECT) != null){
  543. /// *
  544. if (request.getParameter(WebC.REQ_pobjName) != null){
  545. String pName = request.getParameter(WebC.REQ_pobjName);
  546. /// * 改。Lin
  547. // Field pf= ViewObjectUtil.getParentIdField(viewobj,pName);
  548. /// *
  549. ObjFieldB pf= ObjU.rdParentIdField(viewobj, pName);
  550. if (pf != null && request.getParameter(pf.name) != null){
  551. request.setAttribute("pdxidValue", request.getParameter(pf.name));
  552. request.setAttribute("pdxidName",pf.name);
  553. }
  554. }
  555. return SKIP_BODY;
  556. }
  557. */
  558. /* 再改,IDEA:'catch' branch identical to 'RuntimeException' branch。Lin
  559. } catch (RuntimeException e) {
  560. e.printStackTrace();
  561. }catch (Exception e) {
  562. e.printStackTrace();
  563. */ } catch (Exception e) {
  564. /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
  565. e.printStackTrace();
  566. */ log4j.error("TabU.doTabTag( 异常", e);
  567. /* 最外层的 try-catch,不用管 wdgdba 的关闭了(finally {})。Lin
  568. * wdgdba 只有内层的 try-catch 移到 -- 用 'try' with resources
  569. } finally {
  570. if (wdgdba != null)
  571. wdgdba.close();
  572. */
  573. }
  574. }
  575. // ===
  576. // 来自 ViewObjectUtil.(CalculateTabResult) calculateTab(String xmmc, ViewObject viewobj,
  577. // Map<String, String> tabParam,
  578. // boolean isRunning, Map<String, Object> wholeMap, Map<String, Object> permissionParam,
  579. // GeneralDBAccess wdgdba, Boolean isMobile111)。Lin
  580. // 去掉 xmmc、wdgdba
  581. // 再改,拆分 val= 里的内容。Lin
  582. // val='{val:"tagState"}' 改为 name = "tagState"
  583. // val='{val:"baseInfo,child"}' 改为 name="baseInfo,child" -- 简写,不用 Json 格式
  584. // val='{enable:"viewobject.funcMap.play.print",value:"print"}' 改为
  585. // name="print" 和 enable="viewobject.funcMap.play.print"
  586. // 再去掉 isRunning(boolean),没用到,IDEA -- Parameter 'isRunning' is never used。Lin
  587. //!!!打开变动审核页,调用了 64 次本方法!!!Lin
  588. public static TabRunB cmptTab(ObjB viewobj,
  589. Map<String, String> tabParam,
  590. Map<String, Object> wholeMap,
  591. Map<String, Object> permissionParam,
  592. Boolean isMobile111) {
  593. /* 再改,IDEA:'StringBuffer logStr' may be declared as 'StringBuilder'。Lin
  594. StringBuffer logStr = new StringBuffer();
  595. */ StringBuilder logStr = new StringBuilder();
  596. Gson gson = new Gson(); // 增加。Lin
  597. try {
  598. if (wholeMap == null)
  599. wholeMap = new HashMap<>();
  600. Map<String, String> tokenParam = new HashMap<>(); // 这里使 (tokenParam != null),导致 dataType 赋值有问题。Lin
  601. if (wholeMap.get(ObjC.WHOLE_MAP_TOKEN) != null)
  602. //noinspection unchecked
  603. tokenParam = (Map<String, String>) wholeMap.get(ObjC.WHOLE_MAP_TOKEN);
  604. if (permissionParam == null)
  605. permissionParam = new HashMap<>();
  606. HttpServletRequest request = (HttpServletRequest) permissionParam.get("request");
  607. /* 改了。Lin
  608. Map thisBean = (Map) wholeMap.get(ObjConst.WHOLE_MAP_THIS_BEAN_MAP);
  609. */ //noinspection unchecked
  610. Map<String, Object> thisBean = (Map<String, Object>) wholeMap.get(ObjC.WHOLE_MAP_THIS_BEAN_MAP);
  611. // if (thisBean == null || thisBean.size() == 0)
  612. // logStr.append("thisBean not found,\r\n");
  613. // System.out.println(thisBean);
  614. TabRunB ct = new TabRunB();
  615. List<Map<String, Object>> tabList = new LinkedList<>();
  616. /* 再改 minHeight(Long)、maxHeight(Long) 为 int -- 一定有值。Lin
  617. Long minHeight = 0L;
  618. Long maxHeight = 0L;
  619. */
  620. int minHeight = 0;
  621. int maxHeight = 0;
  622. /* 再改,拆分 val= 里的内容。Lin
  623. * 对 'enable:viewobject.funsMap.play.print, value:print',order 为 "print"
  624. * 对 'show:button, dest:env_printInfo, enable:viewobject.funsMap.change.print, from:print',order 为空
  625. * 但 dest 不为空,且 get("from") 为 "print" -- 替换 "print" <func 里的 .dest
  626. String order = tabParam.get("val"); // "value")。Lin
  627. */ String order = tabParam.get("name");
  628. String dest = tabParam.get("dest");
  629. /* 改,(tokenParam != null),但没有内容???Lin
  630. String dataType = tokenParam == null ? ViewChild.TYPE_NORMAL : tokenParam.get("dataType");
  631. */ String dataType = (tokenParam == null ||
  632. tokenParam.isEmpty())? ObjC.CHILD_normType : tokenParam.get(ObjC.CHILD_type);
  633. // 管理参数
  634. /// 对 'enable:viewobject.funsMap.play.print, value:print',order 为 "print"。Lin
  635. /// 对 'show:button, dest:env_printInfo, enable:viewobject.funsMap.change.print, from:print',order 为空。Lin
  636. if (order != null &&
  637. ObjC.CHILD_updType.equals(toTabType(order))) // "update".。Lin
  638. /* 再改 SearchItemCacheB.managementOption(String) 为 SearchItemCacheB.scopeType(int) -- 0 为未指定,99 为所有(原为 "0")。Lin
  639. * 先改,待确认???
  640. tokenParam.put("management", "1");
  641. */ tokenParam.put(SearchC.REQ_scopeType, String.valueOf(SearchC.SCOPE_owner));
  642. boolean enable = true; // 原配置文件里,<func 里的 print= 默认值为 true -- 去掉。Lin
  643. /* 改为 <data.ss name="prt" filter=。Lin
  644. * 再去掉 filter(原 enable:),页面以是否有打印的 <func 为判断条件
  645. String enablestr = tabParam.get("enable");
  646. */
  647. String enablestr = tabParam.get("filter");
  648. // 打印模板
  649. if (StringUtils.isNotBlank(enablestr)) { // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
  650. /* 再改为 Map.of(。Lin
  651. String xx = PageU.paseSymbol(new HashMap<>() {
  652. @Serial
  653. private static final long serialVersionUID = 1L;
  654. {
  655. put("viewobject", viewobj);
  656. }
  657. }, "#{" + enablestr + "}");
  658. */ String xx = PageU.paseSymbol(Map.of("viewobject", viewobj), "#{" + enablestr + "}");
  659. enable = "1".equals(xx) || "true".equals(xx);
  660. /* 再改,IDEA:String concatenation as argument to 'StringBuilder.append()' call。Lin
  661. logStr.append("printenable:" + enablestr + "-" + xx + ",\r\n");
  662. */ logStr.append("printenable:").append(enablestr).append("-").append(xx).append(",\r\n");
  663. }
  664. // String tokenParamStr = "";
  665. //
  666. // int count = 0;
  667. // for (Map.Entry<String, String> entry : tokenParam.entrySet()) {
  668. //
  669. // if (StringUtil.isNull(entry.getValue()))
  670. // continue;
  671. //
  672. // tokenParamStr += entry.getKey() + ":" + entry.getValue();
  673. // if (count != tokenParam.size() - 1) {
  674. // tokenParamStr += ",";
  675. // }
  676. // count++;
  677. // }
  678. // if (tokenParamStr.endsWith(",")) {
  679. // tokenParamStr = tokenParamStr.substring(0, tokenParamStr.length()
  680. // - 1);
  681. // }
  682. /* 再改 width(Long) 为 int -- 一定有值。Lin
  683. Long width = 0L;
  684. */ int width = 0;
  685. String ReqName = null;
  686. if (dest != null) {
  687. try {
  688. ReqName = dest;
  689. String from = tabParam.get("name"); // ("from")。改为 <data.ss name="prt" 了。Lin
  690. ObjFuncB f = viewobj.funcMap.get(from);
  691. Map<String, Object> temp;
  692. if (f != null && enable) {
  693. f = f.clone();
  694. f.dest = dest; // 替换 "print" <func 里的 .dest。Lin
  695. /* 改用 ObjTranslator。Lin
  696. * 去掉 ViewObjectManager,包括其 getInstance()
  697. * 把 ViewObjectManagerImpl.translateFunctionToMap( 移到 ObjTranslator
  698. * 去掉 translateFunctionToMap() 的入口参数 wdGdba、appName
  699. * translateFunctionToMap( 从 ObjTranslator 移到 ObjU,并改为 静态方法了。Lin
  700. temp = ViewObjectManager.getInstance().translateFunctionToMap(f, wdgdba, xmmc, wholeMap,
  701. isMobile111);
  702. */
  703. /* 再增加 viewobj(ObjB),去掉 ObjFuncB.obj(ObjB) -- 不能反过来指定对象。Lin
  704. temp = ObjU.makeFuncMap(f, wholeMap, isMobile111);
  705. */ temp = ObjU.makeFuncMap(f, viewobj, wholeMap, isMobile111);
  706. /* 再改为 IDEA 规范。Lin
  707. * 'tokenParam.size() > 0' can be replaced with '!tokenParam.isEmpty()'
  708. * Method invocation 'isEmpty' may produce 'NullPointerException'
  709. if (tokenParam.size() > 0)
  710. */ if (!(tokenParam.isEmpty()))
  711. /* 再去掉 StrJson.toParmStr(),直接用 gson.toJson(tokenParam)。Lin
  712. * 没有去掉左、右的 "{"、"}"
  713. temp.put("parm", (isMobile111? tokenParam : StrJson.toParmStr(tokenParam)));
  714. // 去掉 ObjU.toJsonParm(),重复了 -- 用 StrJson.toParmStr()。Lin
  715. */ temp.put("parm", (isMobile111? tokenParam : gson.toJson(tokenParam)));
  716. temp.put("name", f.name);
  717. /* 再去掉,ObjU.makeFuncMap( 里已经写了 -- 原写在 temp."name" 里 -- 新查询页。Lin
  718. temp.put("desc", f.playDesc);
  719. */
  720. if (temp.get("width") != null) {
  721. /* 再改 width(Long) 为 int -- 一定有值。Lin
  722. if (Long.parseLong(temp.get("width").toString()) > width) {
  723. width = Long.parseLong(temp.get("width").toString());
  724. }
  725. */
  726. if (Integer.parseInt(temp.get("width").toString()) > width)
  727. width = Integer.parseInt(temp.get("width").toString());
  728. }
  729. /* 再改 minHeight(Long)、maxHeight(Long) 为 int -- 一定有值。Lin
  730. if (null != temp.get("minHeight")) {
  731. // System.out.println("min:"+temp.get("minHeight"));
  732. if (Long.parseLong(temp.get("minHeight").toString()) > minHeight) {
  733. minHeight = Long.parseLong(temp.get("minHeight").toString());
  734. }
  735. }
  736. if (null != temp.get("maxHeight")) {
  737. // System.out.println("max:"+temp.get("maxHeight"));
  738. if (Long.parseLong(temp.get("maxHeight").toString()) > maxHeight) {
  739. maxHeight = Long.parseLong(temp.get("maxHeight").toString());
  740. }
  741. }
  742. */
  743. if (temp.get("minHeight") != null) {
  744. if (Integer.parseInt(temp.get("minHeight").toString()) > minHeight)
  745. minHeight = Integer.parseInt(temp.get("minHeight").toString());
  746. }
  747. if (temp.get("maxHeight") != null) {
  748. if (Integer.parseInt(temp.get("maxHeight").toString()) > maxHeight)
  749. maxHeight = Integer.parseInt(temp.get("maxHeight").toString());
  750. }
  751. if (request != null) {
  752. if (StringUtils.isNotBlank(f.servName)) {
  753. // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
  754. try {
  755. Integer jlztm = (permissionParam.get("jlztm") == null) ? null
  756. : (Integer) permissionParam.get("jlztm");
  757. if (UserU.chkSauthByLogin(f.servName, f.name, jlztm, request)) {
  758. tabList.add(temp);
  759. } else {
  760. /* 再改,IDEA:String concatenation as argument to 'StringBuilder.append()' call。Lin
  761. logStr.append("no permission:"+ f.servName +",\r\n");
  762. */ logStr.append("no permission:").append(f.servName).append(",\r\n");
  763. }
  764. } catch (Exception e) {
  765. /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
  766. e.printStackTrace();
  767. */ log4j.error("TabU.cmptTab( 异常", e);
  768. }
  769. } else {
  770. tabList.add(temp);
  771. }
  772. } else {
  773. tabList.add(temp);
  774. }
  775. }
  776. } catch (Exception e) {
  777. /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
  778. e.printStackTrace();
  779. */ log4j.error("TabU.cmptTab( 异常", e);
  780. }
  781. }
  782. // System.out.println(111);
  783. /* 再改,IDEA:Redundant character escape '\\,' in RegExp。Lin
  784. if (order != null && order.split("\\,").length == 1)
  785. */
  786. /* 再,先简单改(用技巧),value="printTemplates,printx" 改为 name="prtDef" 了 -- 没有 "," 了。Lin
  787. * value="changeBaseInfo,children" 等,有 ","
  788. * 另,原 value='enable:viewobject.funsMap.play.print, value:print',order="print" -- 没有 ","
  789. * value='show:button, dest:env_printInfo, enable:viewobject.funsMap.change.print, from:print',order 为空
  790. if (order != null && order.split(",").length == 1)
  791. */ if (order != null && order.split(",").length == 1 &&
  792. !(TabC.TAB_prtDef.equals(order))) // 过滤 name="prtDef"。Lin
  793. ReqName = order;
  794. if (order != null) {
  795. /* 再改,IDEA:Redundant character escape '\\,' in RegExp。Lin
  796. for (String o : order.split("\\,")) { // 导致 o 有 "{"/"}",如 "{enable:"viewobject.funcMap.play.print""。Lin
  797. */ for (String o : order.split(",")) { // 导致 o 有 "{"/"}",如 "{enable:"viewobject.funcMap.play.print""。Lin
  798. // System.out.println("finding:"+o);
  799. /// 再增加,支持变动 没有一级对象变动授权的 二级对象。Lin
  800. // cobjChg.ss.jsp 里写 <tab.ss name="chgCobj,child"/>
  801. // if (ObjC.FUNC_chgCobjName.equals(o))
  802. // o = ObjC.FUNC_baseInfoName; // 转为 "baseInfo" -- 不能变动基本情况。Lin
  803. ///
  804. /* 去掉 propertyName = "name",直接用 obj.funcMap.get(name)
  805. Function f = ViewObjectUtil.findViewObjectFunction(viewobj, Function.FUNCTION_NAME, o);
  806. */
  807. /* 再改,增加 <obj ref= -- viewobj 改为引用对象。Lin
  808. ObjFuncB f = viewobj.funcMap.get(o);
  809. */
  810. if (ObjC.FUNC_baseInfoName.equals(o) && (viewobj.robj != null))
  811. viewobj = viewobj.robj;
  812. ObjFuncB f = viewobj.funcMap.get(o);
  813. Map<String, String> normalParam = new HashMap<>(tokenParam);
  814. if (request != null && request.getParameter(WebC.REQ_pobjName) != null)
  815. normalParam.put(WebC.REQ_pobjName, request.getParameter(WebC.REQ_pobjName));
  816. if (f == null) {
  817. /* "children" 改为 "child"。Lin
  818. if ("children".equals(o)) {
  819. */ if ((TabC.TAB_child).equals(o)) {
  820. // for (Map.Entry<String, ViewObject> entry :
  821. // viewobj.getChildren().entrySet()) {
  822. /* 去掉 ViewChildren,把里面的变量上移到 ObjB 里。Lin
  823. List<ViewChild> allViewChild = viewobj.getViewChildren().getAllViewChild();
  824. for (ObjChildB vc : allViewChild) {
  825. */ for (ObjChildB vc : viewobj.childMap.values()) {
  826. // logStr.append(vc.name + vc.typeList + ","); // "chgInfo[play, bdplay],",去掉,是信息。Lin
  827. Map<String, String> childParam = new HashMap<>(tokenParam);
  828. // 值班详情按只读模式打开,但值班人员是可维护的二级对象。
  829. if (("xshZb".equals(viewobj.name) || "xyttZb".equals(viewobj.name))
  830. && "rccy".equals(vc.name))
  831. childParam.put(ObjC.CHILD_type, ObjC.CHILD_playChgType);
  832. if (request != null && request.getParameter(WebC.REQ_pobjName) != null) {
  833. String pName = request.getParameter(WebC.REQ_pobjName);
  834. childParam.put(WebC.REQ_pobjName, pName);
  835. if (vc.obj != null) {
  836. /* 再改 ObjU.rdParentIdField(,直接返回父亲 ID 字段名 -- 去掉 .idField(ObjFieldB),直接用新加的 .idName(String)。Lin
  837. ObjFieldB pf = ObjU.rdParentIdField(vc.obj, pName);
  838. if (pf != null && request.getParameter(pf.name) != null) {
  839. childParam.put(pf.name, request.getParameter(pf.name));
  840. }
  841. */
  842. String pfName = ObjU.rdPobjIdName(vc.obj, pName); //?// 去掉,改为 ssPobjId,避免与二级对象的 ID 重名 -- 家长(二级对象)、学员(一级对象),都是人员(ryid) -- 规范 request."ssPobjName"、."ssPobjId"。Lin
  843. if (pfName != null && request.getParameter(pfName) != null)
  844. childParam.put(pfName, request.getParameter(pfName)); //?// 改为 ssPobjId,避免与二级对象的 ID 重名 -- 家长(二级对象)、学员(一级对象),都是人员(ryid) -- 规范 request."ssPobjName"、."ssPobjId"。Lin
  845. }
  846. }
  847. if (vc.tgtPobjIdName != null && thisBean != null) {
  848. // String
  849. // dxid=childrenParam.get(viewobj.getObjectIdField().getName());
  850. if (thisBean.get(vc.pobjIdName) != null
  851. && !(thisBean.get(vc.pobjIdName)).equals("null")) {
  852. String dxid = String.valueOf(thisBean.get(vc.pobjIdName));
  853. // childParam.remove(viewobj.getObjectIdField().getName());
  854. childParam.put(vc.tgtPobjIdName, dxid);
  855. } else {
  856. /// 这里的 "dxid" 应该不用改为 WebC.REQ_objId,thisBean 应该是对象记录的内容。Lin
  857. // 待确认??? -- 增加时,thisBean.size() = 0
  858. childParam.put(vc.tgtPobjIdName, String.valueOf(thisBean.get("dxid"))); // , thisBean.get("dxid") + "")。Lin
  859. ///
  860. }
  861. }
  862. // visibility匹配属性
  863. /* 再改,IDEA:'vc.filterMap.size() > 0' can be replaced with '!vc.filterMap.isEmpty()'。Lin
  864. if (vc.filterMap.size() > 0 && thisBean != null) {
  865. */
  866. /* 再改,使用 null。Lin
  867. if (!(vc.filterMap.isEmpty()) && (thisBean != null)) {
  868. */ if ((vc.filterMap != null) && !(vc.filterMap.isEmpty()) && (thisBean != null)) {
  869. boolean allMatch = false;
  870. for (Map.Entry<String, List<String>> ent : vc.filterMap.entrySet()) {
  871. Object v = thisBean.get(ent.getKey());
  872. if (v != null) {
  873. allMatch = ent.getValue().contains(v.toString());
  874. }
  875. if (!allMatch)
  876. break;
  877. }
  878. if (!allMatch)
  879. continue;
  880. }
  881. /* 再去掉,移到下面用到的地方。Lin
  882. String tabLiName;// tab 显示名
  883. String tabLiDesc;// tab 显示名
  884. /// * 改,去掉 findViewObjectFunction(,直接用 obj.funcMap.get(。Lin
  885. // Function search = ViewObjectUtil.findViewObjectFunction(viewobj, Function.FUNCTION_NAME,
  886. // vc.getName());
  887. /// *
  888. ObjFuncB search = viewobj.funcMap.get(vc.name);
  889. */
  890. if (vc.obj != null && vc.obj.isRoot && (!(vc.obj.hasMenu))) {
  891. /* 再改,IDEA:String concatenation as argument to 'StringBuilder.append()' call。Lin
  892. logStr.append("menu is false :" + vc.obj.name + "\r\n");
  893. */ logStr.append("menu=\"false\":").append(vc.obj.name).append("\r\n");
  894. continue;
  895. }
  896. ///// 从上面移到这。Lin
  897. String tabLiName;// tab 显示名
  898. String tabLiDesc;// tab 显示名
  899. /// 再增加,增加 "iconName"、"subiconName" -- 增加 个人菜单.业务名,实现 新UI 的图标体系。Lin
  900. // "iconName" 为对象图标,"subiconName" 为角图标,如 baseInfo(基本情况)
  901. String tabLiIconName;
  902. /* 再去掉,去掉 "subiconName" 了 -- 不用叠加角图标方案,用层级区分一级对象、二级对象 -- 增加 "pobj"=true 和 "cobj"=true。Lin
  903. String tabLiSubiconName = null;
  904. */
  905. ///
  906. ObjFuncB search = viewobj.funcMap.get(vc.name);
  907. /////
  908. /// 再增加 objB(ObjB),去掉 ObjFuncB.obj(ObjB) -- 不能反过来指定对象。Lin
  909. ObjB objB = viewobj;
  910. ///
  911. if (search == null) {
  912. if (vc.obj != null) {
  913. // 新扩展 变动,修改查找dragChange
  914. /* 再去掉,二级对象的 DDP 改为管理按钮了 -- 还是照旧的查询功能 ObjC.FUNC_searchName("search")。Lin
  915. if (ObjC.CHILD_chgType.equals(dataType) || // ViewChild.TYPE_CHANGE.。Lin
  916. ObjC.CHILD_updType.equals(dataType)) { // ViewChild.TYPE_UPDATE.。Lin
  917. /// * 去掉 ViewObjectUtil.findViewObjectFunction(,直接用 obj.funcMap.get()。Lin
  918. // * ViewObjectUtil.FN_NAME_DRAG_CHANGE > ObjC.FUNC_dragChgName("dragChange")
  919. // * qzcy.object.xml(群组成员) 用到 <function name="dragChange" desc="拖选" service="qz_xg_cy_cx" dest="qz_xg_cy_tx"/>
  920. // search = ViewObjectUtil.findViewObjectFunction(vc.getObj(),
  921. // Function.FUNCTION_NAME, FN_NAME_DRAG_CHANGE);
  922. /// *
  923. search = vc.obj.funcMap.get(ObjC.FUNC_searchDdpName);
  924. /// 再增加 objB(ObjB),去掉 ObjFuncB.obj(ObjB) -- 不能反过来指定对象。Lin
  925. objB = vc.obj;
  926. ///
  927. }
  928. if (search == null) {
  929. */
  930. /* 去掉 ViewObjectUtil.findViewObjectFunction(,直接用 obj.funcMap.get()。Lin
  931. * ViewObjectUtil.FN_NAME_SEARCH
  932. search = ViewObjectUtil.findViewObjectFunction(vc.getObj(),
  933. Function.FUNCTION_NAME, FN_NAME_SEARCH);
  934. */ search = vc.obj.funcMap.get(ObjC.FUNC_searchName);
  935. /// 再增加 objB(ObjB),去掉 ObjFuncB.obj(ObjB) -- 不能反过来指定对象。Lin
  936. objB = vc.obj;
  937. ///
  938. if (search == null) {
  939. /* 再改,IDEA:String concatenation as argument to 'StringBuilder.append()' call 。Lin
  940. logStr.append(viewobj.name + ".children fail:" + vc.name + ",\r\n");
  941. */ logStr.append(viewobj.name).append(".children fail:").append(vc.name).append(",\r\n");
  942. continue;
  943. }
  944. ///// 再增加,增加点击选项卡的 editDdp 服务的 URL 参数 ddpCobjName=、ddpSrcObjName= -- 再把 biz.qz.QzServ 抽取为底层支撑,通过实现 Ddp 接口类来区分差异。Lin
  945. /* 再去掉,改为通过 ObjFuncB.parmMap > SearchServ.searchObj() > ObjU.makeFuncMap( 传递参数到 DDP 管理按钮。Lin
  946. * 增加 DdpC.REQ_ddpSrcPobjName 参数 -- 支持二级对象的 DDP
  947. * 原通过 TabU.cmptTab( > SearchU.rdMagicData( > SearchServ.searchObj() 里的 map.put("param", gson.toJson(magicData)) 传递参数到每个管理按钮
  948. * 不用传递 DdpC.REQ_ddpCobjName 参数,通过服务 <对象名>_editDdp 的 obj 参数传递到 DdpServ.obj -- 服务 "ss.editDdp" 归入对象 -- 需要授权
  949. /// * 再改为 .ddpSrcObjName,值来自 <obj ddp="ry" -- 完全实现 SS 支撑。Lin
  950. // if (vc.obj.isDdp)
  951. // childParam.put(DdpC.REQ_ddpName, vc.name);
  952. /// *
  953. if (vc.obj.ddpSrcObjName != null) {
  954. childParam.put(DdpC.REQ_ddpCobjName, vc.name);
  955. childParam.put(DdpC.REQ_ddpSrcObjName, vc.obj.ddpSrcObjName);
  956. }
  957. */
  958. /////
  959. ///// 再增加,增加点击选项卡的 sortSeq 服务的 URL 参数 ddp= -- 增加 SS 排序功能,排序到 序号 字段 -- <obj sort="true"。Lin。Lin
  960. /* 再去掉,改为通过 ObjFuncB.parmMap > SearchServ.searchObj() > ObjU.makeFuncMap( 传递参数到 DDP 管理按钮。Lin
  961. * 原通过 TabU.cmptTab( > SearchU.rdMagicData( > SearchServ.searchObj() 里的 map.put("param", gson.toJson(magicData)) 传递参数到每个管理按钮
  962. * 不用传递 DdpC.REQ_seqObjName 参数,通过服务 <对象名>_sortSeq 的 obj 参数传递到 DdpServ.obj -- 服务 "ss.sortSeq" 归入对象,需要授权
  963. if (vc.obj.sortable) {
  964. childParam.put(DdpC.REQ_seqObjName, vc.name);
  965. }
  966. */
  967. /////
  968. childParam.put(WebC.REQ_pobjName, viewobj.name); //?// 增加 ssPobjId,避免与二级对象的 ID 重名 -- 家长(二级对象)、学员(一级对象),都是人员(ryid) -- 规范 request."ssPobjName"、."ssPobjId"。Lin
  969. tabLiName = viewobj.name +"_"+ vc.obj.name +"_"+ search.name;
  970. tabLiDesc = vc.obj.playDesc; // "年级"。Lin
  971. /// 再增加,增加 "iconName"、"subiconName" -- 增加 个人菜单.业务名,实现 新UI 的图标体系。Lin
  972. // "iconName" = 二级对象图标
  973. // 二级对象没有角图标 "subiconName"
  974. tabLiIconName = vc.obj.name;
  975. ///
  976. } else {
  977. /* 再改,IDEA:String concatenation as argument to 'StringBuilder.append()' call 。Lin
  978. logStr.append(viewobj.name + ".children fail:" + vc.name + "\r\n");
  979. */ logStr.append(viewobj.name).append(".children fail:").append(vc.name).append("\r\n");
  980. continue;
  981. }
  982. } else {
  983. tabLiName = viewobj.name +"_"+ search.name;
  984. tabLiDesc = search.playDesc; // "变动"。Lin
  985. /// 再增加,增加 "iconName"、"subiconName" -- 增加 个人菜单.业务名,实现 新UI 的图标体系。Lin
  986. // "iconName" = 变动图标
  987. // 变动选项卡没有角图标 "subiconName" -- 变动图标为固定图标,不用"对象图标上叠加角图标"
  988. // 再改为用层级区分一级对象、二级对象,不用叠加角图标方案 -- 增加 "pobj"=true 和 "cobj"=true -- 变动图标 没有 "pobj" 和 "cobj",是 一级图标,是一级对象的变动
  989. tabLiIconName = SkinC.ICON_chgName;
  990. ///
  991. }
  992. wholeMap.put(ObjC.WHOLE_MAP_THISFUNCTION, search);
  993. /* 再改为 IDEA 规范。Lin
  994. * 'if' statement has empty body
  995. * String concatenation as argument to 'StringBuilder.append()' call
  996. if ((vc.typeList).contains(ObjC.CHILD_normType)) { // ViewChild.TYPE_NORMAL。Lin
  997. } else if ((vc.typeList).contains(dataType)) {
  998. } else if (dataType == null) {
  999. } else {
  1000. logStr.append(viewobj.name + ".children fail: name=" + vc.name + ",dataType=" + dataType + ",\r\n");
  1001. continue;
  1002. }
  1003. */
  1004. boolean editableRccyInPlay = ("xshZb".equals(viewobj.name) || "xyttZb".equals(viewobj.name))
  1005. && "rccy".equals(vc.name)
  1006. && ObjC.CHILD_playType.equals(dataType);
  1007. if (!(vc.typeList.contains(ObjC.CHILD_normType)) && // ViewChild.TYPE_NORMAL。Lin
  1008. !(vc.typeList.contains(dataType)) &&
  1009. !editableRccyInPlay &&
  1010. (dataType != null)) {
  1011. logStr.append(viewobj.name).append(".children fail: name=").
  1012. append(vc.name).append(",dataType=").append(dataType).append(",\r\n");
  1013. continue;
  1014. }
  1015. /* 去掉死代码 -- 前面的 else 被 continue 了。Lin
  1016. if (search == null) {
  1017. logStr.append(viewobj.name +".children fail:"+ vc.name +",\r\n");
  1018. continue;
  1019. }
  1020. 去掉死代码。Lin */
  1021. /* 去掉死代码。Lin
  1022. if (false && isMobile111) { // 晕死!!!Lin
  1023. Map<String, Object> temp = new HashMap<String, Object>();
  1024. temp.put("service",
  1025. (search.serv).split("\\.").length <= 1
  1026. ? (SsConst.APP_NAME +"."+ search.serv)
  1027. : search.serv);
  1028. String bjid = null;
  1029. try {
  1030. // Long thisid = new
  1031. // BjDaoImpl().selectBjid(search.getDest(),
  1032. // xmmc, wdgdba, true);
  1033. // String
  1034. // thisid=WebUtil.findPageIdByName(search.getDest(),
  1035. // xmmc);
  1036. String thisid = search.dest;
  1037. bjid = thisid == null ? "1" : thisid;
  1038. } catch (Exception e) {
  1039. logStr.append("6666:"+ search.dest +"\r\n");
  1040. e.printStackTrace();
  1041. }
  1042. if (bjid != null) {
  1043. temp.put("dest", bjid);
  1044. }
  1045. temp.put("param", childParam);
  1046. temp.put("name", tabLiName);
  1047. temp.put("desc", tabLiDesc);
  1048. // 先去掉,不知何用,用到再弄。Lin
  1049. // String wdTabSite = vc.getWdTabSite();
  1050. // if (wdTabSite != null)
  1051. // temp.put("wdTabSite", wdTabSite);
  1052. // End。Lin
  1053. try {
  1054. if (request != null) {
  1055. if (UserUtil.isShowBtn(search.serv,
  1056. permissionParam.get("jlztm") != null
  1057. ? (String) permissionParam.get("jlztm")
  1058. : null,
  1059. request,
  1060. null)) { // type
  1061. tabList.add(temp);
  1062. } else {
  1063. logStr.append("no permission:"+ search.serv +",\r\n");
  1064. }
  1065. } else {
  1066. tabList.add(temp);
  1067. }
  1068. } catch (Exception e) {
  1069. e.printStackTrace();
  1070. }
  1071. } else
  1072. 去掉死代码。Lin */
  1073. {
  1074. /* 改用 ObjTranslator。Lin
  1075. * 去掉 ViewObjectManager,包括其 getInstance()
  1076. * 把 ViewObjectManagerImpl.translateFunctionToMap( 移到 ObjTranslator
  1077. * 去掉 translateFunctionToMap() 的入口参数 wdGdba、appName
  1078. * ObjTranslator.translateFunctionToMap( 移到 ObjU,并改为 静态方法了。Lin
  1079. Map<String, Object> temp = ViewObjectManager.getInstance()
  1080. .translateFunctionToMap(search, wdgdba, xmmc, wholeMap, isMobile111);
  1081. */
  1082. /* 再增加 objB(ObjB),去掉 ObjFuncB.obj(ObjB) -- 不能反过来指定对象。Lin
  1083. Map<String, Object> temp = ObjU.makeFuncMap(search, wholeMap, isMobile111);
  1084. */ Map<String, Object> temp = ObjU.makeFuncMap(search, objB, wholeMap, isMobile111);
  1085. /* 再去掉,IDEA -- Condition 'temp == null' is always 'false'。Lin
  1086. if (temp == null) {
  1087. /// * 再改,IDEA:String concatenation as argument to 'StringBuilder.append()' call。Lin
  1088. // logStr.append(viewobj.name + ".children fail:" + vc.name + "\r\n");
  1089. /// *
  1090. logStr.append(viewobj.name).append(".children fail:").append(vc.name).append("\r\n");
  1091. continue;
  1092. }
  1093. */
  1094. temp.put("name", tabLiName);
  1095. temp.put("desc", tabLiDesc); // "年级"、"变动"。Lin
  1096. ///// 再增加,增加 "iconName"、"subiconName" -- 增加 个人菜单.业务名,实现 新UI 的图标体系。Lin
  1097. // 二级对象、变动选项卡没有角图标 "subiconName" -- 变动图标为固定图标,不用"对象图标上叠加角图标"
  1098. if (ObjC.FUNC_chgName.equals(search.name))
  1099. temp.put("iconName", tabLiIconName); // 变动功能固定为 icno-chg。Lin
  1100. else
  1101. temp.put("iconName", SkinC.ICON_objPrfx + tabLiIconName);
  1102. /// 再增加,返回 "cobj"=true,是二级对象 -- 新UI 方案改为 通过层级区分 一级对象、二级对象,不用叠加角图标做法。Lin
  1103. // 变动图标 没有 "pobj" 和 "cobj",是 一级图标,是一级对象的变动
  1104. temp.put("cobj", true);
  1105. ///
  1106. /////
  1107. /* 改。Lin
  1108. temp.put("param", isMobile111 ? childParam : createParam(childParam));
  1109. */
  1110. /* 再去掉 StrJson.toParmStr(),直接用 gson.toJson(childParam)。Lin
  1111. * 没有去掉左、右的 "{"、"}"
  1112. temp.put("param", isMobile111? childParam : StrJson.toParmStr(childParam));
  1113. */
  1114. /* 再改,temp."param" 改为 ."parm" -- 新查询页时。Lin
  1115. temp.put("param", isMobile111? childParam : gson.toJson(childParam));
  1116. */ temp.put("parm", isMobile111? childParam : gson.toJson(childParam));
  1117. // 兼容仍在使用的旧版 objInfo.jsp:旧模板读取 service、param,新模板读取 servName、parm。
  1118. temp.put("service", search.servName);
  1119. temp.put("param", temp.get("parm"));
  1120. /* 先去掉,不知何用,用到再弄。Lin
  1121. String wdTabSite = vc.getWdTabSite();
  1122. if (wdTabSite != null)
  1123. temp.put("wdTabSite", wdTabSite);
  1124. */
  1125. try {
  1126. if (request != null) {
  1127. if (UserU.chkSauthByLogin(search.servName, null, // null = type。Lin
  1128. (permissionParam.get("jlztm") == null)? null : (Integer.valueOf(String.valueOf(permissionParam.get("jlztm")))),
  1129. request)) {
  1130. tabList.add(temp);
  1131. } else {
  1132. /* 再改,IDEA:String concatenation as argument to 'StringBuilder.append()' call 。Lin
  1133. logStr.append("no permission:" + search.servName + ",");
  1134. */ logStr.append("no permission:").append(search.servName).append(",");
  1135. }
  1136. } else {
  1137. tabList.add(temp);
  1138. }
  1139. } catch (Exception e) {
  1140. /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
  1141. e.printStackTrace();
  1142. */ log4j.error("TabU.cmptTab( 异常", e);
  1143. }
  1144. //noinspection DuplicatedCode
  1145. if (temp.get("width") != null) {
  1146. /* 再改 width(Long) 为 int -- 一定有值。Lin
  1147. if (Long.parseLong(temp.get("width").toString()) > width) {
  1148. width = Long.parseLong(temp.get("width").toString());
  1149. }
  1150. */
  1151. if (Integer.parseInt(temp.get("width").toString()) > width)
  1152. width = Integer.parseInt(temp.get("width").toString());
  1153. }
  1154. /* 再改 minHeight(Long)、maxHeight(Long) 为 int -- 一定有值。Lin
  1155. if (null != temp.get("minHeight")) {
  1156. if (Long.parseLong(temp.get("minHeight").toString()) > minHeight) {
  1157. minHeight = Long.parseLong(temp.get("minHeight").toString());
  1158. }
  1159. }
  1160. if (null != temp.get("maxHeight")) {
  1161. if (Long.parseLong(temp.get("maxHeight").toString()) > maxHeight) {
  1162. maxHeight = Long.parseLong(temp.get("maxHeight").toString());
  1163. }
  1164. }
  1165. */
  1166. if (temp.get("minHeight") != null) {
  1167. if (Integer.parseInt(temp.get("minHeight").toString()) > minHeight)
  1168. minHeight = Integer.parseInt(temp.get("minHeight").toString());
  1169. }
  1170. if (temp.get("maxHeight") != null) {
  1171. if (Long.parseLong(temp.get("maxHeight").toString()) > maxHeight)
  1172. maxHeight = Integer.parseInt(temp.get("maxHeight").toString());
  1173. }
  1174. }
  1175. // }
  1176. }
  1177. } else if ((TabC.TAB_prtDef).equals(o)) { // "printTemplates".。Lin
  1178. /* 改用 ObjTranslator。Lin
  1179. * 去掉 ViewObjectManager,包括其 getInstance()
  1180. * 把 ViewObjectManagerImpl.translatePrintTemplates() 移到 ObjTranslator
  1181. * 去掉 translatePrintTemplates() 的入口参数 wdgdba、xmmc
  1182. Map<String, Object> printTemplates = ViewObjectManager.getInstance()
  1183. .translatePrintTemplates(viewobj, wdgdba, xmmc, wholeMap, false);
  1184. */
  1185. /* 再把 ObjTranslator.translatePrintTemplates( 移到这,只有这里用到。Lin
  1186. Map<String, Object> printTemplates = (new ObjTranslator())
  1187. .translatePrintTemplates(viewobj, wholeMap, false); // false = ismobile
  1188. */ Map<String, Object> printTemplates =
  1189. translatePrintTemplates(viewobj, wholeMap, false); // false = ismobile
  1190. if (printTemplates != null) {
  1191. /* 再改 minHeight(Long)、maxHeight(Long) 为 int -- 一定有值。Lin
  1192. if (printTemplates.get("minHeight") != null) {
  1193. if (Long.parseLong(printTemplates.get("minHeight").toString()) > minHeight)
  1194. minHeight = Long.parseLong(printTemplates.get("minHeight").toString());
  1195. }
  1196. if (printTemplates.get("maxHeight") != null) {
  1197. if (Long.parseLong(printTemplates.get("maxHeight").toString()) > maxHeight)
  1198. maxHeight = Long.parseLong(printTemplates.get("maxHeight").toString());
  1199. }
  1200. */
  1201. if (printTemplates.get("minHeight") != null) {
  1202. if (Integer.parseInt(printTemplates.get("minHeight").toString()) > minHeight)
  1203. minHeight = Integer.parseInt(printTemplates.get("minHeight").toString());
  1204. }
  1205. if (printTemplates.get("maxHeight") != null) {
  1206. if (Integer.parseInt(printTemplates.get("maxHeight").toString()) > maxHeight)
  1207. maxHeight = Integer.parseInt(printTemplates.get("maxHeight").toString());
  1208. }
  1209. if (printTemplates.get("width") != null) {
  1210. /* 再改 width(Long) 为 int -- 一定有值。Lin
  1211. if (Long.parseLong(printTemplates.get("width").toString()) > width)
  1212. width = Long.parseLong(printTemplates.get("width").toString());
  1213. */
  1214. if (Integer.parseInt(printTemplates.get("width").toString()) > width)
  1215. width = Integer.parseInt(printTemplates.get("width").toString());
  1216. }
  1217. if (printTemplates.get("tabList") != null)
  1218. /* 改了。Lin
  1219. tabList.addAll((List) printTemplates.get("tabList"));
  1220. */
  1221. //noinspection unchecked
  1222. tabList.addAll((List<Map<String, Object>>) printTemplates.get("tabList"));
  1223. }
  1224. }
  1225. continue;
  1226. }
  1227. wholeMap.put(ObjC.WHOLE_MAP_THISFUNCTION, f);
  1228. Map<String, Object> temp;
  1229. /* 去掉死代码。Lin
  1230. if (false && isMobile111) { // 这样写,条件是不可能成立的?!!!晕死。Lin
  1231. temp.put("service", f.serv.split("\\.").length <= 1
  1232. ? (SsConst.APP_NAME +"."+ f.serv)
  1233. : f.serv);
  1234. String bjid = null;
  1235. try {
  1236. // Long thisid = new
  1237. // BjDaoImpl().selectBjid(f.getDest(), xmmc, wdgdba,
  1238. // true);
  1239. String thisid = f.dest;
  1240. bjid = thisid == null ? "1" : thisid.toString();
  1241. } catch (Exception e) {
  1242. SsLog.print("6666:"+ f.dest);
  1243. e.printStackTrace();
  1244. }
  1245. if (bjid != null) {
  1246. temp.put("dest", bjid);
  1247. }
  1248. temp.put("param", normalParam);
  1249. temp.put("name", f.name);
  1250. temp.put("desc", f.dispDesc);
  1251. } else
  1252. 去掉死代码。Lin */
  1253. {
  1254. /* 改用 ObjTranslator。Lin
  1255. * 去掉 ViewObjectManager,包括其 getInstance()
  1256. * 把 ViewObjectManagerImpl.translateFunctionToMap( 移到 ObjTranslator
  1257. * 去掉 translateFunctionToMap( 的入口参数 wdGdba、appName
  1258. * ObjTranslator.translateFunctionToMap( 移到 ObjU,并改为 静态方法了。Lin
  1259. temp = ViewObjectManager.getInstance().translateFunctionToMap(f, wdgdba, xmmc, wholeMap,
  1260. isMobile111);
  1261. */
  1262. /* 再增加 viewobj(ObjB),去掉 ObjFuncB.obj(ObjB) -- 不能反过来指定对象。Lin
  1263. temp = ObjU.makeFuncMap(f, wholeMap, isMobile111);
  1264. */ temp = ObjU.makeFuncMap(f, viewobj, wholeMap, isMobile111);
  1265. /* 再改,IDEA:'normalParam.size() > 0' can be replaced with '!normalParam.isEmpty()'。Lin
  1266. if (normalParam.size() > 0)
  1267. */ if (!(normalParam.isEmpty()))
  1268. /* 改。Lin
  1269. * 去掉 ObjU.toJsonParm(),重复了 -- 用 StrJson.toParmStr()
  1270. temp.put("param", isMobile111 ? tokenParam : createParam(tokenParam));
  1271. */
  1272. /* 再去掉 StrJson.toParmStr(),直接用 gson.toJson(normalParam)。Lin
  1273. * 没有去掉左、右的 "{"、"}"
  1274. temp.put("param", (isMobile111? normalParam : StrJson.toParmStr(normalParam)));
  1275. */
  1276. /* 再改,temp."param" 改为 ."parm" -- 新查询页时。Lin
  1277. temp.put("param", (isMobile111? normalParam : gson.toJson(normalParam)));
  1278. */ temp.put("parm", (isMobile111? normalParam : gson.toJson(normalParam)));
  1279. temp.put("name", f.name);
  1280. /* 再去掉,ObjU.makeFuncMap( 里已经写了 -- 原写在 temp."name" 里 -- 新查询页。Lin
  1281. temp.put("desc", f.playDesc); // "基本情况"、"信息"(info)。Lin
  1282. */
  1283. /// 再增加,增加 "iconName"、"subiconName" -- 增加 个人菜单.业务名,实现 新UI 的图标体系。Lin
  1284. // "iconName" = 对象图标(主图标)
  1285. // "subiconName" = 角图标,叠加在对象图标上
  1286. if (ObjC.FUNC_baseInfoName.equals(f.name) ||
  1287. ObjC.FUNC_chgBaseInfoName.equals(f.name)) {
  1288. temp.put("iconName", SkinC.ICON_objPrfx + viewobj.name);
  1289. /* 再改为,返回 "pobj"=true,是一级对象 -- 新UI 方案改为 通过层级区分 一级对象、二级对象,不用叠加角图标做法。Lin
  1290. temp.put("subiconName", SkinC.SUBICON_baseInfoName);
  1291. */ temp.put("pobj", true);
  1292. }
  1293. ///
  1294. if (temp.get("width") != null) {
  1295. /* 再改 width(Long) 为 int -- 一定有值。Lin
  1296. if (Long.parseLong(temp.get("width").toString()) > width) {
  1297. width = Long.parseLong(temp.get("width").toString());
  1298. }
  1299. */
  1300. if (Integer.parseInt(temp.get("width").toString()) > width)
  1301. width = Integer.parseInt(temp.get("width").toString());
  1302. }
  1303. /* 再改 minHeight(Long)、maxHeight(Long) 为 int -- 一定有值。Lin
  1304. if (null != temp.get("minHeight")) {
  1305. // System.out.println("min:"+temp.get("minHeight"));
  1306. if (Long.parseLong(temp.get("minHeight").toString()) > minHeight) {
  1307. minHeight = Long.parseLong(temp.get("minHeight").toString());
  1308. }
  1309. }
  1310. if (null != temp.get("maxHeight")) {
  1311. // System.out.println("max:"+temp.get("maxHeight"));
  1312. if (Long.parseLong(temp.get("maxHeight").toString()) > maxHeight) {
  1313. maxHeight = Long.parseLong(temp.get("maxHeight").toString());
  1314. }
  1315. }
  1316. */
  1317. if (temp.get("minHeight") != null) {
  1318. if (Integer.parseInt(temp.get("minHeight").toString()) > minHeight)
  1319. minHeight = Integer.parseInt(temp.get("minHeight").toString());
  1320. }
  1321. if (temp.get("maxHeight") != null) {
  1322. if (Integer.parseInt(temp.get("maxHeight").toString()) > maxHeight)
  1323. maxHeight = Integer.parseInt(temp.get("maxHeight").toString());
  1324. }
  1325. }
  1326. if (request != null) {
  1327. if (StringUtils.isNotBlank(f.servName) && enable) {
  1328. // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
  1329. try {
  1330. Integer jlztm = (permissionParam.get("jlztm") == null) ? null
  1331. : Integer.valueOf(permissionParam.get("jlztm").toString());
  1332. if (UserU.chkSauthByLogin(f.servName, f.name, jlztm, request)) {
  1333. tabList.add(temp);
  1334. } else {
  1335. /* 再改,IDEA:String concatenation as argument to 'StringBuilder.append()' call。Lin
  1336. logStr.append("no permission:" + f.servName + "\r\n");
  1337. */ logStr.append("???,no permission:").append(f.servName).append("\r\n");
  1338. /// 再增加,写错误信息到 TabRunB.noAuthMsg -- 点击待办,打开的办理页里,没有相应的服务授权会导致局部空白 -- 没有 miniInfo,没有 同意、退回 按钮。Lin
  1339. // 不显示 服务名,后台有显示
  1340. ct.noAuth = true;
  1341. ///
  1342. }
  1343. } catch (Exception e) {
  1344. /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
  1345. e.printStackTrace();
  1346. */ log4j.error("TabU.cmptTab( 异常", e);
  1347. }
  1348. } else {
  1349. tabList.add(temp);
  1350. }
  1351. } else {
  1352. tabList.add(temp);
  1353. }
  1354. }
  1355. }
  1356. // YhUtil.isShowButton(appName, serviceName, jlztm, request)
  1357. /* 再改,IDEA:'tabList.size() > 0' can be replaced with '!tabList.isEmpty()'。Lin
  1358. if (tabList.size() > 0) {
  1359. */ if (!(tabList.isEmpty())) {
  1360. ct.funcAtrMap = tabList.get(0);
  1361. ct.reqName = ReqName;
  1362. }
  1363. ct.width = width;
  1364. ct.tabList = tabList;
  1365. ct.maxHeight = maxHeight;
  1366. ct.minHeight = minHeight;
  1367. return ct;
  1368. /* 再改,IDEA:。Lin
  1369. } catch (RuntimeException e) {
  1370. e.printStackTrace();
  1371. } catch (Exception e) {
  1372. e.printStackTrace();
  1373. */
  1374. } catch (Exception e) {
  1375. /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
  1376. e.printStackTrace();
  1377. */ log4j.error("TabU.cmptTab( 异常", e);
  1378. } finally {
  1379. String l = logStr.toString();
  1380. if (StringUtils.isNotBlank(l)) { // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
  1381. SsLog.log("????????,calculateTab error:" + l);
  1382. // System.out.println(l);
  1383. }
  1384. }
  1385. return null;
  1386. }
  1387. // 来自 大母体的 ViewObjectManagerImpl.translatePrintTemplates()。Lin
  1388. // 去掉 wdgdba、xmmc 入口参数
  1389. public static Map<String, Object> translatePrintTemplates(ObjB vo, Map<String, Object> wholeMap, boolean ismobile){
  1390. SsLog.print("translatePrintTemplates:"+ vo.name); // ("translatePrintTemplates-------------------"+。Lin
  1391. SsLog.print(wholeMap.toString());
  1392. // Db gdba = null; // 移到 try 里,按 IDEA 规范 -- 'try' can use automatic resource management。Lin
  1393. @SuppressWarnings("unchecked")
  1394. Map<String,Object> beanMap = (Map<String, Object>) wholeMap.get(ObjC.WHOLE_MAP_THIS_BEAN_MAP);
  1395. try (Db gdba = Db.makeConn()) {
  1396. /* 改用默认 JNDI。Lin
  1397. gdba=GeneralDBAccess.getInstance(CoreConstVars.DB_JNDI_NAME_NNDX);
  1398. */
  1399. /* 再,移到 try 里,按 IDEA 规范 -- 'try' can use automatic resource management。Lin
  1400. gdba = Db.makeConn();
  1401. */
  1402. List<Map<String, Object>> tabList = new LinkedList<>();
  1403. //Map<String,Function> funsMap=vo.getFunsMap();
  1404. //Function function=funsMap.get("play");
  1405. //Field f=vo.getObjectIdField();
  1406. //修改要求0264改为去掉dymb表
  1407. // 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()+"'";
  1408. /* 改。Lin
  1409. String sql="select bgmbid,mc,service from bgmb where bgmblbm = 41 and dxm = :dxm and jlztm<>55";
  1410. */
  1411. /* 再改,jlztm<>55 改为 ObjC.JLZT_notInSusStr -- 增加了(不包括) 26(JLZT_inResChk)。Lin
  1412. * 表格模板.服务名(SERV) 改为 .FWM
  1413. String sql= "select BGMBID,MC,SERV from BGMB where BGMBLBM=" + FormC.FORM_prtType +
  1414. " and DXM=:dxm and JLZTM<>" + ObjC.JLZT_inSus;
  1415. */ String sql= "select BGMBID,MC,FWM from BGMB where BGMBLBM=" + FormC.FORM_prtType +
  1416. " and DXM=:dxm and "+ ObjC.JLZT_actStr;
  1417. SqlCmd sqlCmd = new SqlCmd(sql);
  1418. sqlCmd.wrStrParm("dxm", vo.name);
  1419. List<Map<String,Object>> dymblist = gdba.doSelMapListByC(sqlCmd);
  1420. /* 再改为 IDEA 规范。Lin
  1421. if(dymblist.size()==0){
  1422. */ if (dymblist.isEmpty()) {
  1423. SsLog.print("IIII,没找到打印模板:"+ vo.name); // ("dymb not setting:"+。Lin
  1424. /* 先改为 return,有问题再弄 -- 没有模板,为什么不 return???Lin
  1425. // return null;
  1426. */
  1427. /* 再,不能 return,需要再处理 高级打印模板。Lin
  1428. return null;
  1429. */
  1430. }
  1431. /* 再改,IDEA:Type may be primitive。Lin
  1432. * 改为 int
  1433. Long minHeight = 0L;
  1434. Long maxHeight=minHeight;
  1435. Long width=minHeight;
  1436. */
  1437. int minHeight = 0;
  1438. int maxHeight = 0;
  1439. int width = 0;
  1440. //表格模板,最大宽高
  1441. //*16:px改为rem
  1442. /// 要改为预生成 -- 写在 表格模板 表里???Lin
  1443. /* 改。Lin
  1444. sql="select max(yzb+gd)*16 height,max(xzb+kd)*16 width from bgbj"
  1445. +" where bgmbid in(select bgmbid from bgmb where jlztm<>55 and dxm='"+ vo.name +"')";
  1446. */
  1447. /* 再改,jlztm<>55 改为 ObjC.JLZT_notInSusStr -- 增加了(不包括) 26(JLZT_inResChk)。Lin
  1448. sql = "select max(YZB+GD)*16 height,max(XZB+KD)*16 width from BGBJ"+
  1449. " where BGMBID in(select BGMBID from BGMB where JLZTM<>"+ ObjC.JLZT_inSus +" and DXM='"+ vo.name +"')";
  1450. */ sql = "select max(YZB+GD)*16 height,max(XZB+KD)*16 width from BGBJ"+
  1451. " where BGMBID in(select BGMBID from BGMB where "+ ObjC.JLZT_actStr +" and DXM='"+ vo.name +"')";
  1452. ///
  1453. for (Map<String, Object> m : gdba.doSelMapList(sql)) {
  1454. if ((m.get("width") == null) || (m.get("height") == null)) {
  1455. SsLog.print("表格模板未设置!"); // ("表格模板未设置!")。Lin
  1456. break;
  1457. }
  1458. /* 再改,IDEA:Type may be primitive。Lin
  1459. * 改为 int 了 -- 转来转去,在干啥 -- 转为 Double,再转为 Long
  1460. Double w=Double.parseDouble(m.get("width").toString());
  1461. Double h=Double.parseDouble(m.get("height").toString());
  1462. width=w.longValue();
  1463. maxHeight=h.longValue();
  1464. */
  1465. width = Integer.parseInt(m.get("width").toString());
  1466. maxHeight = Integer.parseInt(m.get("height").toString());
  1467. }
  1468. /* 再去掉,SsListener.contextInitialized( 里的 MenuU.premakeObjRunMenu() 调用进来时,request 为 null -- 还没登录。Lin
  1469. * 此时,beanMap 为空 -- 不显示就算了
  1470. SsLog.print(beanMap.toString());
  1471. */
  1472. /* 去掉,不支持多个应用。Lin
  1473. WebApp app = vo.getWebapp();
  1474. */
  1475. HttpServletRequest request = (HttpServletRequest) wholeMap.get(ObjC.WHOLE_MAP_REQUEST);
  1476. for (Map<String,Object> dymb : dymblist) {
  1477. SsLog.print(dymb.toString());
  1478. /* 去掉,没用到。Lin
  1479. String bgmbid=dymb.get("bgmbid").toString();
  1480. */
  1481. dymb.put("desc", dymb.get("mc").toString());
  1482. /* 再改,表格模板.服务名(SERV) 改为 .FWM。Lin
  1483. String service = (dymb.get("service")==null)? null : (dymb.get("service").toString());
  1484. */ String service = (dymb.get("fwm")==null)? null : (dymb.get("fwm").toString());
  1485. if (StringUtils.isNotBlank(service)) { // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
  1486. if (UserU.chkSauthByLogin(service, null, null, request)) { // null = type、jlztm。Lin
  1487. tabList.add(dymb);
  1488. } else {
  1489. SsLog.print("没有权限:"+service);
  1490. }
  1491. } else {
  1492. tabList.add(dymb);
  1493. }
  1494. }
  1495. /* 去掉 funs,直接用 (obj.funcMap).values()。Lin
  1496. * 增加了 ObjB.prtFuncList
  1497. List<Function> funs =vo.getFuns();
  1498. for(int i=0;i<funs.size();i++){
  1499. if(StringUtil.notNull(funs.get(i).getPrintNo())){
  1500. */
  1501. List<ObjFuncB> funs = vo.prtFuncList;
  1502. /* 再改,IDEA:'for' loop can be replaced with enhanced 'for'。Lin
  1503. for(int i = 0; i < funs.size(); i++){
  1504. */ for (ObjFuncB objFunc : funs) {
  1505. // if(StrU.notNull(funs.get(i).prtNo)){ // 不用判断了,改用 ObjB.prtFuncList。Lin
  1506. // boolean flag = false; // 移到下面 -- 重写。Lin
  1507. /* 再改,IDEA:'for' loop can be replaced with enhanced 'for'。Lin
  1508. * 重写
  1509. if (StringUtils.isNotBlank(funs.get(i).servName)) { // StrU.notNull()。Lin
  1510. if(UserU.chkSauthByLogin(funs.get(i).servName, null, null, request)){ // null = type、jlztm。Lin
  1511. flag = true;
  1512. }
  1513. } else {
  1514. flag = true;
  1515. }
  1516. */ boolean flag = StringUtils.isBlank(objFunc.servName) ||
  1517. UserU.chkSauthByLogin(objFunc.servName, null, null, request);
  1518. if (flag) {
  1519. /* 再去掉,按 IDEA 规范 -- 'putAll()' call can be replaced with parametrized constructor call。Lin
  1520. Map<String, Object> param = new HashMap<>();
  1521. */
  1522. Map<String, Object> dymb = new HashMap<>();
  1523. /* 再改,IDEA:'for' loop can be replaced with enhanced 'for'。Lin
  1524. dymb.put("desc", funs.get(i).desc);
  1525. dymb.put("dymbfunction", funs.get(i).name);
  1526. */
  1527. /* 再改用 .playDesc。Lin
  1528. dymb.put("desc", objFunc.desc);
  1529. dymb.put("dymbfunction", objFunc.name);
  1530. */
  1531. dymb.put("desc", objFunc.playDesc);
  1532. dymb.put("dymbfunction", objFunc.name);
  1533. SsLog.print(dymb.toString());
  1534. /* 再改,按 IDEA 规范 -- 'putAll()' call can be replaced with parametrized constructor call。Lin
  1535. param.putAll(dymb);
  1536. */ Map<String, Object> param = new HashMap<>(dymb);
  1537. /* 再改,SsListener.contextInitialized( 里的 MenuU.premakeObjRunMenu() 调用进来时,request 为 null -- 还没登录。Lin
  1538. * 此时,beanMap 为空
  1539. param.putAll(beanMap);
  1540. */ if (beanMap != null)
  1541. param.putAll(beanMap);
  1542. /* 再改,IDEA:'for' loop can be replaced with enhanced 'for'。Lin // objFunc 和 fun 是完全一样的???Lin
  1543. ObjFuncB fun = (vo.funcMap).get(funs.get(i).name);
  1544. */
  1545. /* 再去掉 fun(ObjFuncB),共用 objFunc -- 与 objFunc 是完全一样的 -- 兜一圈。Lin
  1546. ObjFuncB fun = vo.funcMap.get(objFunc.name);
  1547. */
  1548. /* 再去掉 fun(ObjFuncB),共用 objFunc -- 与 objFunc 是完全一样的。Lin
  1549. Map<String, Object> m = ObjU.makeFuncMap(fun, wholeMap, ismobile);
  1550. */
  1551. /* 再增加 vo(ObjB),去掉 ObjFuncB.obj(ObjB) -- 不能反过来指定对象。Lin
  1552. Map<String, Object> m = ObjU.makeFuncMap(objFunc, wholeMap, ismobile);
  1553. */ Map<String, Object> m = ObjU.makeFuncMap(objFunc, vo, wholeMap, ismobile);
  1554. // 从这移到 ObjU,并改为 静态方法。Lin
  1555. /* 再去掉,IDEA -- Condition 'm != null' is always 'true'。Lin
  1556. if (m != null) {
  1557. */
  1558. dymb.putAll(m);
  1559. /* 再去掉 StrJson.toParmStr(),直接用 new Gson().toJson(param)。Lin
  1560. * 没有去掉左、右的 "{"、"}"
  1561. dymb.put("param", StrJson.toParmStr(param));
  1562. // 去掉 ObjU.toJsonParm(),重复了 -- 用 StrJson.toParmStr()。Lin
  1563. */
  1564. /* 再改,dymb."param" 改为 ."parm" -- 新查询页时。Lin
  1565. dymb.put("param", new Gson().toJson(param));
  1566. */ dymb.put("parm", new Gson().toJson(param));
  1567. try {
  1568. /* 再改,IDEA:Type may be primitive。Lin
  1569. * 改为 int 了
  1570. Long pbWidth = Long.valueOf(dymb.get("width").toString());
  1571. Long pbHeight =Long.valueOf(dymb.get("height").toString());
  1572. */
  1573. int pbWidth = Integer.parseInt(dymb.get("width").toString());
  1574. int pbHeight = Integer.parseInt(dymb.get("height").toString());
  1575. if (width < pbWidth)
  1576. width = pbWidth;
  1577. if (maxHeight < pbHeight)
  1578. maxHeight = pbHeight;
  1579. } catch (Exception e) {
  1580. SsLog.print("部件宽高没设置");
  1581. /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
  1582. e.printStackTrace();
  1583. */ log4j.error("TabU.translatePrintTemplates( 异常", e);
  1584. }
  1585. tabList.add(dymb);
  1586. /* 再去掉,IDEA -- Condition 'm != null' is always 'true'。Lin
  1587. } else {
  1588. /// * 再去掉 fun(ObjFuncB),共用 objFunc -- 与 objFunc 是完全一样的。Lin
  1589. // SsLog.print("找不到部件:" + fun.dest);
  1590. /// *
  1591. SsLog.print("找不到部件:" + objFunc.dest);
  1592. }
  1593. */
  1594. } else {
  1595. /* 再改,IDEA:'for' loop can be replaced with enhanced 'for'。Lin
  1596. SsLog.print("没权限:"+ funs.get(i).servName);
  1597. */ SsLog.print("没权限:" + objFunc.servName);
  1598. }
  1599. // } // 不用判断了,改用 ObjB.prtFuncList。Lin
  1600. }
  1601. Map<String,Object> result = new HashMap<>();
  1602. result.put("maxHeight", maxHeight);
  1603. result.put("minHeight", minHeight);
  1604. result.put("width", width);
  1605. result.put("tabList", tabList);
  1606. SsLog.print(result.toString());
  1607. return result;
  1608. } catch (Exception e) {
  1609. /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
  1610. e.printStackTrace();
  1611. */ log4j.error("TabU.translatePrintTemplates( 异常", e);
  1612. SsLog.print("dymb :"+ e.getMessage());
  1613. /* 再去掉,移到 try 里了 -- 按 IDEA 规范 -- 'try' can use automatic resource management。Lin
  1614. }finally{
  1615. if(gdba!=null)
  1616. gdba.close();
  1617. */
  1618. }
  1619. return null;
  1620. }
  1621. // 来自 ViewObjectUtil.createParam()。Lin
  1622. /* 去掉,重复了。用 StrJson.toParmStr()。Lin
  1623. public static String makeParm(Map<String, ?> param) {
  1624. String result = "";
  1625. // for(Map.Entry entry:param.entrySet()){
  1626. // if(entry.getValue()==null)continue;
  1627. // if(StringUtil.isNull(entry.getValue().toString()))continue;
  1628. // result+=entry.getKey()+":"+entry.getValue()+",";
  1629. // }
  1630. // if(result.endsWith(","))
  1631. // result=result.substring(0,result.length()-1);
  1632. result = new Gson().toJson(param);
  1633. // 去掉 StrJson.toJsonStr(),直接用 new Gson().toJson()。Lin
  1634. result = result.substring(1, result.length() - 1);
  1635. return result;
  1636. }
  1637. */
  1638. // 来自 ViewObjectUtil.(String) tabState(String v)。Lin
  1639. // 判断条件 (v.indexOf("baseUpdate") > 0) 不好理解 -- v = <tab.ss 或 <data.ss 里的 name
  1640. private static String toTabType(String v) {
  1641. String result = ObjC.CHILD_playType; // = "play"。Lin
  1642. /* 去掉,没意义。Lin
  1643. if (v.indexOf(ObjC.FUNC_baseInfoName) > 0) // "baseInfo")。Lin
  1644. result = ObjC.CHILD_playType; // = "play"。Lin
  1645. */
  1646. if (v.indexOf("baseUpdate") > 0)
  1647. result = ObjC.CHILD_updType; // = "update"。Lin
  1648. return result;
  1649. }
  1650. // 来自 ViewObjectUtil.(Map<String, String>) parseTabValue(String str)。Lin
  1651. // 对对象形式,改用 Json 格式
  1652. /* 去掉,再改为:val 里的内容,都用 Json 写法 -- 包括数组形式。Lin
  1653. * "include_input"/"editBaseInfo,child" 改为 "{val:'include_input'}"/"{val:'editBaseInfo,child'}"
  1654. public static Map<String, String> rdTabVal(String str) {
  1655. Map<String, String> result = new HashMap<>();
  1656. if (StringUtils.isBlank(str)) // 去掉 StrU.isNull(),直接用 StringUtils.isBlank()。Lin
  1657. return result;
  1658. if (str.contains(":")) {
  1659. /// * 改用 JSon 格式。Lin
  1660. // for (String s : str.split(",")) {
  1661. // result.put(s.split("\\:")[0], s.split("\\:")[1]);
  1662. // }
  1663. /// *
  1664. return StrJson.toMap(str);
  1665. } else {
  1666. result.put("val", str); // ("value",。Lin
  1667. }
  1668. return result;
  1669. }
  1670. */
  1671. // 合成 tabValue(Map<String, String>),为了 TabU.cmptTab( 的入口参数
  1672. // 增加,类似 rdTabVal()。Lin
  1673. // 再改,拆分 val= 里的内容。Lin
  1674. // val='{val:"tagState"}' 改为 name = "tagState"
  1675. // val='{val:"baseInfo,child"}' 改为 name="baseInfo,child" -- 简写,不用 Json 格式
  1676. // val='{enable:"viewobject.funcMap.play.print",value:"print"}' 改为
  1677. // name="print" 和 enable="viewobject.funcMap.play.print"
  1678. // val='{show:"button",dest:"env_printInfo",enable:"viewobject.funsMap.change.print",from:"print"}' 改为
  1679. // name="prt" filter="viewobject.funsMap.change.print" btn="true" dest="env_printInfo"
  1680. /* 再去掉 show(String),去掉 <data.ss name="prt" 里的 btn="true" 了 -- 直接写 <jsp.ss file="/ss/prtIcon.jsp"/>。Lin
  1681. * 再去掉 enable(String) 和 dest(String),只有 <data.ss name="prt"/> 了
  1682. * enable:,值来自 <func print="true" -- 页面实际上是根据 "prt" <func 去过滤
  1683. * 用 dest(env_printInfo.jsp) 替换 from <func 里的 .dest -- 不用 env_printInfo.jsp,共用 env_print.jsp
  1684. public static Map<String, String> combTabVal(String name, String enable, String show, String dest) {
  1685. */
  1686. /* 再去掉,直接写 Map.of("name", this.name)。Lin
  1687. * TabTag 和 DataTag 共用,DataTag 不能调用 TabU
  1688. * 调用 TabU.combTabVal( 时的 name 不会为空
  1689. * 只有一句 Map.put("name", name) 了
  1690. public static Map<String, String> combTabVal(String name) {
  1691. Map<String, String> result = new HashMap<>();
  1692. if (StringUtils.isBlank(name))
  1693. return result;
  1694. result.put("name", name);
  1695. /// * 再去掉 enable(String),值来自 <func print="true" -- 页面实际上是根据 "prt" <func 去过滤。Lin
  1696. // if (StringUtils.isNotBlank(enable))
  1697. // result.put("filter", enable); // ("enable",。"enable" 改为 "filter"。Lin
  1698. /// *
  1699. /// * 再去掉 show(String),去掉 <data.ss name="prt" 里的 btn="true" 了 -- 直接写 <jsp.ss file="/ss/prtIcon.jsp"/>。Lin
  1700. // * "enable" 是笔误
  1701. // if (StringUtils.isNotBlank(show))
  1702. // result.put("enable", show);
  1703. /// *
  1704. /// * 再去掉 dest(String),dest(env_printInfo.jsp) 替换 from <func 里的 .dest -- 不用 env_printInfo.jsp,共用 env_print.jsp。Lin
  1705. // if (StringUtils.isNotBlank(dest))
  1706. // result.put("dest", dest);
  1707. /// *
  1708. return result;
  1709. }
  1710. */
  1711. // 来自 TabTag.(Object) findJlztm(ViewObject obj)。Lin
  1712. // 再从 TabTag 移出来了,与 DataTag 共用 -- 增加 DataTag 了
  1713. // 增加 pageContext(PageContext),从 TabTag 移出来了
  1714. /* 再去掉,移到 DataTag.rdJlztm(,TabTag 没用到了。Lin
  1715. public static Object rdJlztm(ObjB obj, PageContext pageContext) {
  1716. String jlztm = null;
  1717. Db gdba = null;
  1718. try {
  1719. // jlztm = null; // 去掉,上面已经置为 null 了。Lin
  1720. Object k;
  1721. k = pageContext.getAttribute("itemKey");
  1722. if (pageContext.getRequest().getAttribute("itemKey") != null)
  1723. k = pageContext.getRequest().getAttribute("itemKey");
  1724. if (k != null) {
  1725. Object o = pageContext.getAttribute(k.toString());
  1726. if (pageContext.getRequest().getAttribute(k.toString()) != null)
  1727. o = pageContext.getRequest().getAttribute(k.toString());
  1728. if (o instanceof Map) {
  1729. jlztm = ((Map<?, ?>) o).get("jlztm").toString();
  1730. } else {
  1731. // Class<? extends Object> c = o.getClass();
  1732. //
  1733. // Method m = c.getMethod("getJlztm");
  1734. Object jlztmO = ObjU.rdClazzAtr("jlztm", o); // BeanUtils.getFieldValue()。Lin
  1735. jlztm = (jlztmO == null) ? null : jlztmO.toString();
  1736. }
  1737. }
  1738. if (StringUtils.isBlank(jlztm) && obj != null) { // StringUtil.isNull()。Lin
  1739. /// * 再改,IDEA:Local variable 'objName' is redundant。Lin
  1740. // String objName = obj.name;
  1741. // k = objName;
  1742. /// *
  1743. k = obj.name;
  1744. if (k != null) {
  1745. Object o = pageContext.getAttribute(k.toString());
  1746. if (pageContext.getRequest().getAttribute(k.toString()) != null)
  1747. o = pageContext.getRequest().getAttribute(k.toString());
  1748. if (o instanceof Map) {
  1749. jlztm = ((Map<?, ?>) o).get("jlztm").toString();
  1750. } else if (o != null) {
  1751. // Class<? extends Object> c = o.getClass();
  1752. //
  1753. // Method m = c.getMethod("getJlztm");
  1754. // jlztm = String.valueOf(m.invoke(o));
  1755. Object jlztmO = ObjU.rdClazzAtr("jlztm", o); // BeanUtils.getFieldValue()。Lin
  1756. jlztm = (jlztmO == null) ? null : jlztmO.toString();
  1757. }
  1758. }
  1759. }
  1760. if (StringUtils.isBlank(jlztm)) { // StringUtil.isNull()。Lin
  1761. /// * 改。Lin
  1762. // BaseBean bean = (BaseBean) Class.forName(obj.getObjClass()).newInstance();
  1763. // if (bean.getFieldMap().containsKey("jlztm") == false)
  1764. /// *
  1765. /// * 再,.poName 改为 .poClazz。Lin
  1766. // Po bean = (Po) Class.forName(obj.poName).getDeclaredConstructor().newInstance();
  1767. /// *
  1768. Po bean = obj.poClazz.getDeclaredConstructor().newInstance();
  1769. if (!(bean.fieldTypeMap.containsKey("jlztm")))
  1770. return null;
  1771. /// * 再改,去掉 .idField(ObjFieldB),直接用新加的 .idName(String)。Lin
  1772. // String objectIdName = obj.idField.name; // .getObjectIdField().getName()。Lin
  1773. /// *
  1774. String objectIdName = obj.idName; // .getObjectIdField().getName()。Lin
  1775. String objectIdValue = (String) ExpressionEvaluatorManager
  1776. .evaluate("", "${" + objectIdName + "}", String.class, pageContext);
  1777. if (StringUtils.isNotBlank(objectIdValue)) { // StringUtil.notNull()。Lin
  1778. String sql = "select JLZTM from " + bean.tabName + " where " + objectIdName + "=" + objectIdValue;
  1779. /// * 改。Lin
  1780. // gdba = GeneralDBAccess.getInstance(CoreConstVars.DB_JNDI_NAME_NNDX);
  1781. /// *
  1782. gdba = Db.makeConn();
  1783. gdba.doSel(sql); // .select()。Lin
  1784. if (gdba.rowNum > 0)
  1785. jlztm = gdba.rdStrCol("jlztm"); // .getColumnAsString()。Lin
  1786. }
  1787. }
  1788. } catch (Exception e) {
  1789. /// * 再去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
  1790. // e.printStackTrace();
  1791. /// *
  1792. log4j.error("TabU.rdJlztm( 异常", e);
  1793. } finally {
  1794. if (gdba != null)
  1795. gdba.close();
  1796. }
  1797. return jlztm;
  1798. }
  1799. */
  1800. // 再从 TabTag 抽取出来,和 DataTag 共用 -- 增加 DataTag 了。Lin
  1801. public static Map<String, String> makeTokenParm(ObjB viewobj, String idName, String dxid,
  1802. PageContext pageContext, HttpServletRequest request) {
  1803. Map<String, String> tokenParam = new HashMap<>();
  1804. tokenParam.put(idName, dxid);
  1805. /* 再改为 "ssObjName"、"ssObjId",避免与数据表里的 对象名、对象ID 字段重名 -- 导致合并 Map 时,因 Key 同名而互相覆盖 Value。Lin
  1806. tokenParam.put("dxid", dxid);
  1807. tokenParam.put("dxm", viewobj.name);
  1808. */
  1809. tokenParam.put(WebC.REQ_objId, dxid);
  1810. tokenParam.put(WebC.REQ_objName, viewobj.name);
  1811. /// 再增加,增加 "kcid" 的值,续传 Request."kcid" 到 DbServ.selRefById() -- 增加 <obj ref=。Lin
  1812. // 在 TabU.cmptTab( 里从 "zykc" 改为 "kc",故在 DbServ.selRefById() 里,bbidStr = request.getParameter(obj.idName) 获取的是 "kcid"
  1813. if (viewobj.robj != null)
  1814. tokenParam.put(viewobj.robj.idName, request.getParameter(viewobj.robj.idName));
  1815. ///
  1816. try {
  1817. /* 再改。Lin
  1818. * 再从 request 里取 -- 支持小程序
  1819. * 异步加载数据时,不是 JSP 的页面标签,取不到页面里的属性值
  1820. tokenParam.put("sqid", (String) ExpressionEvaluatorManager
  1821. .evaluate("", "${sqid}", String.class, pageContext));
  1822. */
  1823. String val = (String) ExpressionEvaluatorManager.evaluate("", "${sqid}", String.class, pageContext);
  1824. if (StringUtils.isBlank(val)) {
  1825. Object v = request.getAttribute("sqid");
  1826. val = (v == null)? null : String.valueOf(v);
  1827. }
  1828. tokenParam.put("sqid", val);
  1829. /* 再改。Lin
  1830. * 再从 request 里取 -- 支持小程序
  1831. * 异步加载数据时,不是 JSP 的页面标签,取不到页面里的属性值
  1832. tokenParam.put("shid", (String) ExpressionEvaluatorManager
  1833. .evaluate("", "${shid}", String.class, pageContext));
  1834. */
  1835. val = (String) ExpressionEvaluatorManager.evaluate("", "${shid}", String.class, pageContext);
  1836. if (StringUtils.isBlank(val)) {
  1837. Object v = request.getAttribute("shid");
  1838. val = (v == null)? null : String.valueOf(v);
  1839. }
  1840. tokenParam.put("shid", val);
  1841. /* 改。Lin
  1842. tokenParam.put("dataType", (String) ExpressionEvaluatorManager
  1843. .evaluate("", "${dataType}", String.class, pageContext));
  1844. */
  1845. /* 再改。Lin
  1846. * 再从 request 里取 -- 支持小程序
  1847. * 异步加载数据时,不是 JSP 的页面标签,取不到页面里的属性值
  1848. tokenParam.put(ObjC.CHILD_type, (String) ExpressionEvaluatorManager
  1849. .evaluate("", "${"+ ObjC.CHILD_type +"}", String.class, pageContext));
  1850. */
  1851. val = (String) ExpressionEvaluatorManager.evaluate("", "${"+ ObjC.CHILD_type +"}", String.class, pageContext);
  1852. if (StringUtils.isBlank(val))
  1853. val = String.valueOf(request.getAttribute(ObjC.CHILD_type)); // 一定有值,不会输出 "null" 串。Lin
  1854. tokenParam.put(ObjC.CHILD_type, val);
  1855. } catch (JspException e) {
  1856. /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
  1857. e.printStackTrace();
  1858. */ log4j.error("TabU.makeTokenParm( 异常", e);
  1859. return null;
  1860. }
  1861. /* 改,if 条件里不用再取一次。Lin
  1862. * IDEA 规范 -- Condition 'request != null' is always 'true'
  1863. if (request != null && request.getParameter(ViewObjectUtil.REQUEST_PARENT_VIEWOBJECT) != null){
  1864. String pName=request.getParameter(ViewObjectUtil.REQUEST_PARENT_VIEWOBJECT);
  1865. tokenParam.put(ViewObjectUtil.REQUEST_PARENT_VIEWOBJECT,pName);
  1866. */
  1867. String pName = request.getParameter(WebC.REQ_pobjName); // 从 if 里移上来。Lin
  1868. if (pName != null) {
  1869. tokenParam.put(WebC.REQ_pobjName, pName);
  1870. /* 改。Lin
  1871. Field pf= ViewObjectUtil.getParentIdField(viewobj,pName);
  1872. if (pf != null && request.getParameter(pf.name) != null)
  1873. tokenParam.put(pf.name,request.getParameter(pf.name));
  1874. */
  1875. /* 再改 ObjU.rdParentIdField(,直接返回父亲 ID 字段名 -- 去掉 .idField(ObjFieldB),直接用新加的 .idName(String)。Lin
  1876. ObjFieldB pf= ObjU.rdParentIdField(viewobj, pName);
  1877. if (pf != null && request.getParameter(pf.name) != null)
  1878. tokenParam.put(pf.name,request.getParameter(pf.name));
  1879. */
  1880. String pfName = ObjU.rdPobjIdName(viewobj, pName); //?// 改为 ssPobjId,避免与二级对象的 ID 重名 -- 家长(二级对象)、学员(一级对象),都是人员(ryid) -- 规范 request."ssPobjName"、."ssPobjId"。Lin
  1881. if (pfName != null && request.getParameter(pfName) != null)
  1882. tokenParam.put(pfName, request.getParameter(pfName)); //?// 改为 ssPobjId,避免与二级对象的 ID 重名 -- 家长(二级对象)、学员(一级对象),都是人员(ryid) -- 规范 request."ssPobjName"、."ssPobjId"。Lin
  1883. }
  1884. return tokenParam;
  1885. }
  1886. }