/* * 生成1类型窗体文件,生成路径已系统菜单为准,文件为formID_file.jsp为准。 * xiangluan * 2010-04-16 */ package com.yc.service.build.type.v2; import com.yc.action.grid.GridUtils; import com.yc.action.grid.TMuiDTO; import com.yc.api.bean.T9685Entity; import com.yc.api.service.ApiServiceIfc; import com.yc.service.impl.DBHelper; import com.yc.service.panel.SqlDBHelperIfc; import com.yc.service.panel.v2.PanelServiceIfc; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.io.File; import java.util.List; import java.util.Map; @Service("V77") public class T_77_Impl extends BaseImpl implements T_77_Ifc { // 通过功能号id获得明细设置 private static final String GET_TABPAGE_DETAIL = " set nocount on ; select * from _sys_tabpageformid where mainformid=? order by sortby asc"; @Autowired private PanelServiceIfc pIfc; @Autowired SqlDBHelperIfc sqlDBHelperIfc; @Autowired private ApiServiceIfc apiServiceIfc; /* * 生成文件 */ @Override public int build(BaseBean baseBean) throws Exception { Map gformInfo = this.init(baseBean); buildJsCssHead(baseBean); buildTop(gformInfo); buildHelpPage(gformInfo); buildFoolter(baseBean); buildDataHead(gformInfo); buildIndex(gformInfo); return 0; } /** * 通过分组id+页框id获得明细设置 * * @param formGroupId * @return */ public List> getTabPageDetail( String formGroupId) { return this.jdbcTemplate.queryForList(GET_TABPAGE_DETAIL, formGroupId); } /** * 生成主页面 * * @throws Exception */ @Override public void buildIndex(Map gformInfo) throws Exception { String fileName = "index.jsp"; BaseBean baseBean = (BaseBean) gformInfo.get(BEAN_INFO); String formID = baseBean.formID; String doc = baseBean.doc; String data = getPageCode(fileName, baseBean); //--------从gform表获取是否显示大标题字段值(isTitle)判断是否显示大标题,并替换标识符-2012-02-20-syz--------[begin]---------------------- if (GridUtils.prossRowSetDataType_Int(gformInfo, "isTitle") == 1) {//如果配置了显示大标题 String TopAndTitle_str = "\n" + "\n" + "\n" + // "\n" + // "\n" + // "\n" + "\n" + "
\n" + "
[?title]
\n" + "
\n" + // "
\n" + // "
\n" + "
\n" + "\t\t\t<%@ include file=\"top.jsp\" %>\n" + "\t\t
\n" + "
\n"; data = data.replace("[?TopAndTitle]", TopAndTitle_str);//替换功能号标识符 } else {//如果没有配置显示大标题 String TopAndTitle_str = "
\n" + "\t\t\t<%@ include file=\"top.jsp\" %>\n"; data = data.replace("[?TopAndTitle]", TopAndTitle_str);//替换功能号标识符 } //--------从gform表获取是否显示大标题字段值(isTitle)判断是否显示大标题,并替换标识符-2012-02-20-syz-----[end]-------------------------// //---------------- // String jspName=""; String indexInc = ""; int panNo = 0; String panNoStr = ""; try { List> sheMap = this.getTabPageDetail(formID); String[] data1 = null; String fileName1 = null; int formid_Pan = 0; int formtype_Pan = 0; int height1 = 0; int index = 0; for (Map map : sheMap) { indexInc += "
" + DBHelper.getValue(map, "LabelName") + "
"; if (doc == "") doc = DBHelper.getValue(map, "SeekGroupID");//取得第一个功能号的关联字段 formid_Pan = DBHelper.getValueInt(map, "formid"); formtype_Pan = DBHelper.getValueInt(map, "formtype"); switch (formtype_Pan) {// 功能号类型 case 7: fileName1 = "panel_" + formid_Pan + ".jsp"; data1 = new String[2]; data1[0] = FileUtils.readFileToString(new File(getBuildPath(baseBean) + "panel.jsp"), "utf-8"); data1[1] = FileUtils.readFileToString(new File(getTemPath(baseBean) + "panelControl.jsp"), "utf-8"); // ---------------- baseBean.indexPan = panNo; panNoStr = (panNo != 0) ? String.valueOf(panNo) : ""; Map map1 = pIfc.getPanelHtml(formid_Pan, baseBean.type, data1, gformInfo); buildPageCode(map1.get("panHTML").replaceAll("@panelNo@", panNoStr), fileName1, baseBean); buildPageCode(map1.get("panelControl"), "panelControl" + formID + ".jsp", baseBean); indexInc += "<%@ include file=\"" + fileName1 + "\" %>"; //--------grid String indexs[] = this.getPrIndex(DBHelper.getValue(map, "formid"), sheMap, "7"); height1 = DBHelper.getValueInt(map, "gridheight"); if (height1 == 0) height1 = treeGrid.getGrigHieght(DBHelper .getValueInt(map, "formid"), DBHelper .getValueInt(map, "formtype"), baseBean.dataBaseId); TMuiDTO dto = new TMuiDTO(); if (index == 0 || indexs[0] != "") { dto.type = baseBean.type; dto.height1 = height1; dto.indexs = indexs[0]; dto.tolkey = indexs[1]; dto.fromid = Integer.parseInt(formID); dto.index = 0; } else { dto.type = 7; dto.height1 = height1; dto.indexs = ""; dto.tolkey = ""; dto.fromid = 0; dto.index = index; } treeGrid.createGrid(7, formid_Pan, baseBean.URI, "app/" + baseBean.gPath + "/", new String[]{formid_Pan + "_grid.jsp"}, getTemPath(baseBean), "/" + baseBean.formID + "/" + baseBean.type + "/", dto, baseBean.dataBaseId); index++; //--------end panNo++; break; } } } catch (Exception e) { e.printStackTrace(); } //-------------文字颜色说明---------xin 2022-5-18 16:09:54-----------// StringBuilder colorText =new StringBuilder();//文字颜色说明 if(StringUtils.isNotBlank(baseBean.formID)) { List colorList = apiServiceIfc.get9685List(Integer.parseInt(baseBean.formID)); if (colorList != null && colorList.size() > 0) { colorText.append("文字颜色说明"); for (T9685Entity t : colorList) { colorText.append("
" + "" + t.getColorName() + "
"); } } } //文字颜色说明 xin 2022-5-18 15:53:13 data = data.replace("[?ColorDescription]",colorText); data = data.replace("[?title]", gformInfo.get("formname") + ""); data = data.replace("@panFou@", indexInc); buildPageCode(data, fileName, baseBean); } }