/*
|
* 生成1类型窗体文件,生成路径已系统菜单为准,文件为formID_file.jsp为准。
|
* xiangluan
|
* 2010-04-16
|
*/
|
package com.yc.service.build.type;
|
|
import java.io.File;
|
import java.util.ArrayList;
|
import java.util.List;
|
import java.util.Map;
|
|
import com.yc.api.bean.T9685Entity;
|
import com.yc.api.service.ApiServiceIfc;
|
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.lang.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.context.annotation.Scope;
|
import org.springframework.stereotype.Service;
|
|
import com.yc.action.grid.TMuiDTO;
|
import com.yc.service.build.top.BuildTopIfc;
|
import com.yc.service.commons.GformIfc;
|
import com.yc.service.impl.DBHelper;
|
import com.yc.service.panel.PanelServiceIfc;
|
import com.yc.service.panel.SqlDBHelperIfc;
|
|
|
@Service("T_77_impl")
|
@Scope("prototype")
|
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 GformIfc gformIfc;
|
@Autowired
|
private BuildTopIfc buildTopIfc;
|
@Autowired
|
private PanelServiceIfc pIfc;
|
@Autowired
|
SqlDBHelperIfc sqlDBHelperIfc;
|
@Autowired
|
private ApiServiceIfc apiServiceIfc;
|
String doc="";//关联字段
|
/*
|
* 生成文件
|
*/
|
@Override
|
public synchronized int build() throws Exception {
|
Map<String, Object> gformInfo = gformIfc.getGformInfo("predocstatus,formname,showdetail,isopenFuncshowpwdedit,isshowpwdedit,optype,HDTable", Integer.parseInt(formID));
|
buildJsCssHead(gformInfo);
|
buildTop(gformInfo);
|
buildHelpPage(gformInfo);
|
buildFoolter();
|
buildIndex(gformInfo);
|
buildDataHead(gformInfo);
|
return 0;
|
}
|
/**
|
* 生成jsp数据处理头页面
|
* @throws Exception
|
*/
|
public void buildDataHead(Map<String,Object> gformInfo) throws Exception{
|
String fileName = "dataHead.jsp";
|
String tmpJsp = getPageCode(fileName);
|
tmpJsp = tmpJsp.replace("[?formId]", formID);
|
tmpJsp = tmpJsp.replace("[?formType]",type+"");
|
// tmpJsp = tmpJsp.replace("[?isShowPwdEdit]",toString(map.get("isshowpwdedit")));//1类型没有确认
|
tmpJsp = tmpJsp.replace("[?isOpenFuncShowPwdEdit]",toString(gformInfo.get("isopenFuncshowpwdedit")));
|
//--操作类型
|
if(gformInfo.get("optype")!=null&&!StringUtils.isBlank(gformInfo.get("optype").toString())){
|
tmpJsp = tmpJsp.replace("[?formOptType]", gformInfo.get("optype").toString().equalsIgnoreCase("0")?"-1":gformInfo.get("optype").toString());
|
}else{
|
tmpJsp = tmpJsp.replace("[?formOptType]","-1");
|
}
|
tmpJsp=replaceGform(tmpJsp);
|
tmpJsp = tmpJsp.replaceAll("@doc", doc);
|
buildPageCode(tmpJsp, fileName);
|
}
|
/**
|
* 生成js css 导入的页面
|
* @throws Exception
|
*/
|
public void buildJsCssHead(Map<String,Object> gformInfo) throws Exception{
|
String fileName = "jsCssHead.jsp";
|
String data = getPageCode(fileName);
|
// ----------------
|
|
buildPageCode(data, fileName);
|
}
|
/**
|
* 生成top页面
|
* @throws Exception
|
*/
|
public void buildTop(Map<String,Object> gformInfo) throws Exception{
|
buildTopIfc.build(Integer.parseInt(formID), type,getBuildPath()+"top.jsp",getToPath()+"top.jsp",gformInfo,this);
|
}
|
/**
|
* 生成帮助页面
|
* @throws Exception
|
*/
|
public void buildHelpPage(Map<String,Object> gformInfo) throws Exception{
|
buildTopIfc.build(Integer.parseInt(formID), type,getTemPath()+"help.jsp",getToPath()+"help.jsp",gformInfo,this);
|
}
|
/**
|
* 生成foolter页面(资源释放页)
|
* @throws Exception
|
*/
|
public void buildFoolter() throws Exception{
|
String fileName = "foolter.jsp";
|
String data = getPageCode(fileName);
|
//----------------
|
|
buildPageCode(data, fileName);
|
}
|
/**
|
* 通过分组id+页框id获得明细设置
|
*
|
* @param groupid
|
* @param formGroupId
|
* @return
|
*/
|
public List<Map<String, Object>> getTabPageDetail(
|
String formGroupId) {
|
return this.jdbcTemplate.queryForList(GET_TABPAGE_DETAIL,
|
formGroupId);
|
}
|
/**
|
* 生成主页面
|
* @throws Exception
|
*/
|
public void buildIndex(Map<String,Object> gformInfo) throws Exception{
|
String fileName = "index.jsp";
|
String data = getPageCode(fileName);
|
//--------从gform表获取是否显示大标题字段值(isTitle)判断是否显示大标题,并替换标识符-2012-02-20-syz--------[begin]----------------------
|
if(true)
|
{
|
//String menuname_str="";
|
String sSQL=" set nocount on ; select * from gform where formid='"+formID+"' and isTitle='1' ";//isTitle=1表示配置了显示大标题
|
List<Map<String,Object>> arrayList = new ArrayList<Map<String,Object>>();
|
arrayList=getArrayList(sSQL);
|
if(arrayList.size()>0)
|
{//如果配置了显示大标题
|
String TopAndTitle_str=
|
"<table id=\"top_table\" width=\"100%\" bgcolor=\"#DEEDF7\">\n" +
|
"<tr>\n" +
|
"<td>\n" +
|
"<div id=\"title_top\">[?title]</div>\n" +
|
"</td></tr>\n" +
|
// "<tr>\n" +
|
// "<td>\n" +
|
// "<hr style=\"position: absolute;left:0px;top:28px;height: 1px;color: #bdc7c6;width: 99%;\">\n" +
|
// "</td>\n" +
|
// "</tr>\n" +
|
"<tr><td>\n" +
|
"<div id=\"tplt-top\">\n" +
|
"\t\t\t<%@ include file=\"top.jsp\" %>\n" +
|
"\t\t</div>\n" +
|
"</td></tr>\n" +
|
"</table>\n";
|
data=data.replace("[?TopAndTitle]", TopAndTitle_str);//替换功能号标识符
|
}else
|
{//如果没有配置显示大标题
|
String TopAndTitle_str=
|
"<div id=\"tplt-top\">\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<Map<String, Object>> 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<String, Object> map : sheMap) {
|
indexInc+="<div style=\"font-family:黑体;\">"+DBHelper.getValue(map, "LabelName")+"</div>";
|
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()+ "panel.jsp"), "utf-8");
|
data1[1]=FileUtils.readFileToString(new File(getTemPath()+"panelControl.jsp"), "utf-8");
|
// ----------------
|
pIfc.setIndexPan(panNo);
|
panNoStr=(panNo!=0)?String.valueOf(panNo):"";
|
Map<String, String> map1 = pIfc.getPanelHtml(formid_Pan,type, data1, this);
|
buildPageCode(map1.get("panHTML").replaceAll("@panelNo@", panNoStr), fileName1);
|
buildPageCode(map1.get("panelControl"), "panelControl"+formID+".jsp");
|
indexInc+="<%@ include file=\""+fileName1+"\" %>";
|
pIfc.setIndexPan(0);
|
//--------grid
|
// jspName=DBHelper.getValueInt(map, "formid")+"_grid.jsp";
|
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"),this.dataBaseId);
|
|
TMuiDTO dto=new TMuiDTO();
|
if(index==0||indexs[0]!=""){
|
dto.type=this.type;
|
dto.height1=height1;
|
dto.indexs=indexs[0];
|
dto.tolkey=indexs[1];
|
dto.fromid=Integer.parseInt(formID);
|
dto.index=0;
|
//treeGrid.setTabPage497(this.type, height1, indexs[0],indexs[1],Integer.parseInt(formID),0 );
|
}
|
else{
|
dto.type=7;
|
dto.height1=height1;
|
dto.indexs="";
|
dto.tolkey="";
|
dto.fromid=0;
|
dto.index=index;
|
//treeGrid.setTabPage497(7, height1, "","",0,index);
|
}
|
treeGrid.createGrid(7,formid_Pan, URI, "app/" + gPath+"/", new String[]{formid_Pan+"_grid.jsp"}, getTemPath(), "/"+this.formID+"/"+this.type+"/", dto,this.dataBaseId);
|
//height1 = (height1 <= 0) ? 320 : height1 + 20;
|
index++;
|
//--------end
|
panNo++;
|
break;
|
}
|
}
|
}catch(Exception e){
|
e.printStackTrace();
|
}
|
|
//-------------文字颜色说明---------xin 2022-5-18 16:09:54-----------//
|
StringBuilder colorText =new StringBuilder();//文字颜色说明
|
if(StringUtils.isNotBlank(formID)) {
|
List<T9685Entity> colorList = apiServiceIfc.get9685List(Integer.parseInt(formID));
|
if (colorList != null && colorList.size() > 0) {
|
colorText.append("文字颜色说明");
|
for (T9685Entity t : colorList) {
|
colorText.append("<div><span title=\"" + t.getItemMemo() + "\" class=\"spanColor\" " +
|
"style=\"background-color: " + t.getHexColor() + "\"></span>" +
|
"<span style=\"color: " + t.getHexColor() + "\">" +
|
t.getColorName() + "</span></div>");
|
}
|
}
|
}
|
//文字颜色说明 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);
|
}
|
}
|