package com.yc.action.grid; import com.yc.utils.Base64; import com.yc.utils.EncodeUtil; import com.yc.utils.GTJson; import com.yc.utils.JOSNUtils; import java.util.List; import java.util.Map; /** * 封装页面传递参数 * */ public class Grid { private int formID=0;//功能号 private String winType="";//窗体类型 private String where="";//条件 private String field="";//字段列表 private int flag;//标记是不是需要显示数据 private String filte="";//过滤条件 private String doccode="";//单号 private String formdatafilters="";//启动表单时的过滤 private int ProcGroupafterSavedoc=0;//单据保存时保存组 private String DealAfterDocSave="";//保存时执行 private String trangroup="";//过账类型 private String datalist="";//38类型,需要统计的参数 private String dataformid="";//dataformid功能 private String tranformid="";//dataformid功能,确认时候用 private String action=""; private boolean taobao=false; private List taobaoData=null;//保存接口返回的数据 private boolean isCallback=false;//是否是淘宝接口返回的数据,是的则不需要再次调用相关淘宝接口 private Map env;//淘宝需要用 private String keyID;//表示淘宝接口对应表的ID,主从表的时候用;分开 private String picFild=""; private int cp=0;//后台进行复单的标记 private int pageSize=50; private boolean isExcel;//标记当前保存是excel导入的,需要调用保存时过程 private String cancelProc;//取消确认 private int canPric=0;//标记当前是执行取消确认 private String revokeProc;//撤回 private int revokePric=0;//标记当前是执行撤回 private int cancelisSave=0;//标记执行取消确认前是否先保存 private int isExchangeDataWithHost=0;//标记取消确认前是否调用外部接口 private String exwhere=""; private int paging=-1; private int isGantt=0; private int isTree=0;//18类型是否显示为树 private String tbCols=""; private boolean isImport=false;//导入标记 private boolean isDoccode=false;//是否为单据类型 private int autopaging=3;//是否分页 private String hasGrid=""; public int getIsExchangeDataWithHost() { return isExchangeDataWithHost; } public void setIsExchangeDataWithHost(int isExchangeDataWithHost) { this.isExchangeDataWithHost = isExchangeDataWithHost; } public String getRevokeProc() { return revokeProc; } public void setRevokeProc(String revokeProc) { this.revokeProc = revokeProc; } public int getRevokePric() { return revokePric; } public void setRevokePric(int revokePric) { this.revokePric = revokePric; } public String getHasGrid() { return hasGrid; } public void setHasGrid(String hasGrid) { this.hasGrid = hasGrid; } public boolean isDoccode() { return isDoccode; } public void setIsDoccode(boolean isDoccode) { this.isDoccode = isDoccode; } public boolean isImport() { return isImport; } public void setImport(boolean isImport) { this.isImport = isImport; } public int getAutopaging() { return autopaging; } public void setAutopaging(int autopaging) { this.autopaging = autopaging; } public String getTbCols() { return tbCols; } public void setTbCols(String tbCols) { this.tbCols = tbCols; } public int getIsTree() { return isTree; } public void setIsTree(int isTree) { this.isTree = isTree; } public int getIsGantt() { return isGantt; } public void setIsGantt(int isGantt) { this.isGantt = isGantt; } public int getPaging() { return paging; } public void setPaging(int paging) { this.paging = paging; } public int getCancelisSave() { return cancelisSave; } public void setCancelisSave(int cancelisSave) { this.cancelisSave = cancelisSave; } public String getExwhere() { return exwhere; } public void setExwhere(String exwhere) { //this.exwhere = exwhere; if("".equalsIgnoreCase(exwhere)){ this.exwhere= ""; return; } this.exwhere=JOSNUtils.prossBase64(exwhere); } public int getCanPric() { return canPric; } public void setCanPric(int canPric) { this.canPric = canPric; } public String getCancelProc() { return cancelProc; } public void setCancelProc(String cancelProc) { this.cancelProc = cancelProc; } public boolean isExcel() { return isExcel; } public void setExcel(boolean isExcel) { this.isExcel = isExcel; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public int getCp() { return cp; } public void setCp(int cp) { this.cp = cp; } public String getPicFild() { return picFild; } public void setPicFild(String picFild) { this.picFild = picFild; } public String getTranformid() { return tranformid; } public void setTranformid(String tranformid) { this.tranformid = tranformid; } public String getKeyID() { return keyID; } public void setKeyID(String keyID) { this.keyID = keyID; } public Map getEnv() { return env; } public void setEnv(Map env) { this.env = env; } public boolean isCallback() { return isCallback; } public void setCallback(boolean isCallback) { this.isCallback = isCallback; } public List getTaobaoData() { return taobaoData; } public void setTaobaoData(List taobaoData) { this.taobaoData = taobaoData; } public boolean isTaobao() { return taobao; } public void setTaobao(boolean taobao) { this.taobao = taobao; } public String getAction() { return action; } public void setAction(String action) { this.action = action; } public String getDataformid() { return dataformid; } public void setDataformid(String dataformid) { this.dataformid = dataformid; } public String getDatalist() { return datalist; } public void setDatalist(String datalist) { this.datalist = datalist; } public String getTrangroup() { return trangroup; } public void setTrangroup(String trangroup) { this.trangroup = (trangroup==null||trangroup==""?"0":trangroup); } public String getDealAfterDocSave() { return DealAfterDocSave;//!=null?DealAfterDocSave.toLowerCase():""; } public void setDealAfterDocSave(String dealAfterDocSave) { DealAfterDocSave = dealAfterDocSave; } public String getWheres(){//页面用@代替%是因为%会出来传递出错 return " 1=1 "+(this.where.length()>0?" and "+this.where.toLowerCase().replaceAll("#~'$", "%'"):"")+((this.formdatafilters.length()>0)?(" and "+this.formdatafilters.toLowerCase()):""); } public String getDoccode() { return doccode; } public void setDoccode(String doccode) { this.doccode = doccode; } public String getFormdatafilters() { return formdatafilters!=null?formdatafilters.toLowerCase():""; } public void setFormdatafilters(String formdatafilters) { this.formdatafilters = formdatafilters; } public int getProcGroupafterSavedoc() { return ProcGroupafterSavedoc; } public void setProcGroupafterSavedoc(int procGroupafterSavedoc) { ProcGroupafterSavedoc = procGroupafterSavedoc; } public String getFilte() { return filte.toLowerCase(); } public void setFilte(String filte) { this.filte = filte; } public int getFormID() { return formID; } public void setFormID(int formID) { this.formID = formID; } public String getWinType() { return winType.toLowerCase(); } public void setWinType(String winType) { this.winType = winType!=null?winType.replace("@p@", "|"):""; } public String getWhere() { return where!=null?where.replaceAll("_ycid_", "id").replaceAll("%20"," "):""; } public void setWhere(String where) { if("".equalsIgnoreCase(where)){ this.where= ""; return; } try { String tes=""; if(where.indexOf("@p@")>=0){ String[]s=where.split("@p@"); if(s.length>0){//用在格线的过滤传过来的参数 if(this.flag==-1){//处理格线过滤时导出问题 by danaus 2020/2/24 20:52 String temp= new String(Base64.decode(s[0].replaceAll("%2B", "+").replaceAll("%2F", "/").replaceAll("%3D", "=").getBytes("utf-8")),"utf-8"); s[0]=temp+s[1]; } where=s[0]!=null?(s[0].trim().equalsIgnoreCase("@p@")?"":s[0]):""; if(s.length>1) tes=s[1]; }else where=""; } String temp=where; //查看方法在哪个jar包里被调用 //System.out.println(org.apache.commons.codec.binary.Base64.class.getProtectionDomain().getCodeSource().getLocation()); if(org.apache.commons.codec.binary.Base64.isBase64(where)){ where = EncodeUtil.base64Decode(where);//base64解密所有请求where参数 if(org.apache.commons.codec.binary.Base64.isBase64(where)) where=temp; if(where.indexOf("%2B")!=-1){ where = where.replaceAll("%2B", "+");//base64编码中包含+ / 等符号 所以要进行处理 }if(where.indexOf("%2F")!=-1){ where = where.replaceAll("%2F", "/"); } if(where.indexOf("%3D")!=-1){ where = where.replaceAll("%3D", "="); } if(where.indexOf(";")>=0&&tes.trim().indexOf("!")<0) {//表示是由树传过来的参数值,需要增加对在格线中执行过滤的处理 this.where = where+(!"".equalsIgnoreCase(tes)?(where.trim().indexOf("#p#")>0?tes:(";"+tes)):""); } else { this.where = where + (!"".equalsIgnoreCase(tes) ? tes : ""); // if(this.where.trim().startsWith("and")){ // this.where=this.where.replace("and",""); // } } }else{ try { this.where = java.net.URLDecoder.decode(where.replaceAll("\\+", "%2B").replaceAll("\\/", "%2F"),"utf-8"); }catch(Exception e1) { this.where=where; } } if(this.where.indexOf("@G@")==0) this.where = this.where.substring(where.indexOf("@G@")+3);//用 ^代表以前的|,避免因参数值内有|而造成出错 by 2013-7-1 if(this.where.indexOf("@G@")>0) this.where=this.where.replaceAll("@G@"," and "); } catch (Exception e) { e.printStackTrace(); }catch(Throwable e) { e.printStackTrace(); throw e ; } // try { // // this.where = java.net.URLDecoder.decode(where,"utf-8"); // } catch (UnsupportedEncodingException e) { // this.where=""; // e.printStackTrace(); // } } public String getField() { return field.toLowerCase(); } public void setField(String field) { this.field = field!=null?field.replace("@p@", "|"):""; } public int getFlag() { return flag; } public void setFlag(int flag) { this.flag = flag; } }