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