|
|
/*
|
|
|
*
|
|
|
* Copyright (c) 2001-2006 泛微软件.
|
|
|
* 泛微协同商务系统,版权所有.
|
|
|
*
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
package weaver.workflow.mode;
|
|
|
import weaver.log4j.Module;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.api.browser.bean.BrowserBean;
|
|
|
import com.api.browser.bean.BrowserValueInfo;
|
|
|
import com.api.browser.service.BrowserValueInfoService;
|
|
|
import com.api.browser.util.BrowserInitUtil;
|
|
|
import com.api.doc.detail.util.DocDownloadCheckUtil;
|
|
|
import com.api.odoc.util.OdocFileUtil;
|
|
|
import com.engine.fnaMulDimensions.util.BudgetBearerComInfo;
|
|
|
import com.engine.fnaMulDimensions.util.BudgetPeriodComInfo;
|
|
|
import com.engine.fnaMulDimensions.util.BudgetSubjectComInfo;
|
|
|
import com.engine.hrm.biz.OrganizationShowSetBiz;
|
|
|
import com.engine.workflow.biz.FieldInfo.FieldInfoBiz;
|
|
|
import com.engine.workflow.biz.NewReportBiz;
|
|
|
import com.engine.workflow.biz.SecondAuthBiz;
|
|
|
import com.engine.workflow.biz.RobotNode.RobotNodeBiz;
|
|
|
import com.engine.workflow.biz.RobotNode.RobotNodeServiceBiz;
|
|
|
import com.engine.workflow.biz.WorkflowBaseBiz;
|
|
|
import com.engine.workflow.biz.customizeBrowser.BrowserFieldUtil;
|
|
|
import com.engine.workflow.biz.customizeBrowser.BrowserFieldValueComInfo;
|
|
|
import com.engine.workflow.biz.customizeBrowser.CustomBrowserBiz;
|
|
|
import com.engine.workflow.biz.customizeBrowser.CustomizeBrowserRefreshCacheThread;
|
|
|
import com.engine.workflow.biz.excelDesign.DoSaveFreeExcelDesignBiz;
|
|
|
import com.engine.workflow.biz.excelDesign.MainSubWfSignBiz;
|
|
|
import com.engine.workflow.biz.freeNode.FreeNodeBiz;
|
|
|
import com.engine.workflow.cmd.workflowPath.node.form.GetShowDescCmd;
|
|
|
import com.engine.workflow.constant.ShowType;
|
|
|
import com.engine.workflow.constant.node.NodeType;
|
|
|
import com.engine.workflow.constant.ShowTypeEnum;
|
|
|
import com.engine.workflow.constant.SignSource;
|
|
|
import com.engine.workflow.constant.requestForm.RequestConstant;
|
|
|
import com.engine.workflow.entity.NodeSignInputSetEntity;
|
|
|
import com.engine.workflow.entity.core.*;
|
|
|
import com.engine.workflow.entity.excelDesign.MainSubSignEntity;
|
|
|
import com.engine.workflow.entity.nodeForm.NodeFormDesc;
|
|
|
import com.engine.workflow.util.CollectionUtil;
|
|
|
import com.engine.workflow.util.ListUtil;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.commons.logging.Log;
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
import org.jsoup.Jsoup;
|
|
|
import org.jsoup.nodes.Document;
|
|
|
import org.jsoup.nodes.Element;
|
|
|
import org.jsoup.select.Elements;
|
|
|
import weaver.conn.RecordSet;
|
|
|
import weaver.cpt.capital.CapitalComInfo;
|
|
|
import weaver.crm.Maint.CustomerInfoComInfo;
|
|
|
import weaver.dateformat.DateTransformer;
|
|
|
import weaver.dateformat.UnifiedConversionInterface;
|
|
|
import weaver.docs.docs.DocComInfo;
|
|
|
import weaver.docs.senddoc.DocReceiveUnitComInfo;
|
|
|
import weaver.docs.webservices.DocAttachment;
|
|
|
import weaver.fna.general.RequestDetailImportUtil;
|
|
|
import weaver.fna.maintenance.BudgetfeeTypeComInfo;
|
|
|
import weaver.fna.maintenance.FnaSystemSetComInfo;
|
|
|
import weaver.formmode.tree.CustomTreeUtil;
|
|
|
import weaver.general.BaseBean;
|
|
|
import weaver.general.Util;
|
|
|
import weaver.hrm.User;
|
|
|
import weaver.hrm.check.JobComInfo;
|
|
|
import weaver.hrm.company.SubCompanyComInfo;
|
|
|
import weaver.hrm.companyvirtual.DepartmentVirtualComInfo;
|
|
|
import weaver.hrm.companyvirtual.SubCompanyVirtualComInfo;
|
|
|
import weaver.hrm.job.JobTitlesComInfo;
|
|
|
import weaver.hrm.resource.ResourceComInfo;
|
|
|
import weaver.proj.Maint.ProjectInfoComInfo;
|
|
|
import weaver.systeminfo.SystemEnv;
|
|
|
import weaver.workflow.exceldesign.DetailOrderManager;
|
|
|
import weaver.workflow.field.BrowserComInfo;
|
|
|
import weaver.workflow.request.*;
|
|
|
import weaver.workflow.workflow.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.util.*;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
import static weaver.general.Util.getIntValue;
|
|
|
import static weaver.general.Util.null2String;
|
|
|
|
|
|
|
|
|
/**
|
|
|
* Description: 表单字段信息类.
|
|
|
*
|
|
|
* @author mackjoe
|
|
|
* @version 1.0 04/07/06
|
|
|
*/
|
|
|
public class FieldInfo implements Cloneable {
|
|
|
|
|
|
private static final Log log = LogFactory.getLog(FieldInfo.class);
|
|
|
String hr = getHr();
|
|
|
|
|
|
private HttpServletRequest request;
|
|
|
//键为主表字段Id号,值为该字段值。
|
|
|
private Map<String, String> mapMainTblFields = new HashMap<String, String>();
|
|
|
//存储多个明细中的数据。第一级元素为单个明细数据,一个明细数据是一个Arraylist。
|
|
|
//有多行数据,每行数据是一个Map,其中一个字段ID号为键,字段值为值。
|
|
|
private List lstDetailTblFields = new ArrayList();
|
|
|
private ArrayList ManTableFields;
|
|
|
private ArrayList ManTableFieldValues;
|
|
|
private ArrayList ManTableFieldNames;
|
|
|
private ArrayList ManTableFieldFieldNames;
|
|
|
private ArrayList ManTableFieldDBTypes;
|
|
|
private ArrayList ManTableChildFields;
|
|
|
private ArrayList DetailTableFields;
|
|
|
private ArrayList DetailTableFieldValues;
|
|
|
private ArrayList DetailFieldIsViews;
|
|
|
private ArrayList DetailTableFieldIds;
|
|
|
private ArrayList DetailTableIds;
|
|
|
private ArrayList DetailTableFieldNames;
|
|
|
private ArrayList DetailFieldDBTypes;
|
|
|
private ArrayList DetailDBFieldNames;
|
|
|
private ArrayList DetailTableChildFields;
|
|
|
private ArrayList Nodes;
|
|
|
private ArrayList NodeNames;
|
|
|
private ArrayList ManUrlList;
|
|
|
private ArrayList ManUrlLinkList;
|
|
|
private ArrayList DetailUrlList;
|
|
|
private ArrayList DetailUrlLinkList;
|
|
|
private ArrayList DetailTableNames;
|
|
|
private ArrayList DetailTableKeys;
|
|
|
private ArrayList SelectItemValues;
|
|
|
private ArrayList SelectItems;
|
|
|
private ArrayList SelectDefaults;
|
|
|
private BrowserComInfo urlcominfo;
|
|
|
private ResourceComInfo resourcecominfo;
|
|
|
private JobTitlesComInfo jobComInfo;
|
|
|
private WorkflowNodeComInfo workflowNodeComInfo;
|
|
|
private ProjectInfoComInfo prjcominfo;
|
|
|
private CustomerInfoComInfo crmcominfo;
|
|
|
private OrganizationShowSetBiz orgShowBiz;
|
|
|
private DepartmentVirtualComInfo deptVirComInfo;
|
|
|
private SubCompanyComInfo subcomcominfo;
|
|
|
private SubCompanyVirtualComInfo subCompVirComInfo;
|
|
|
private DocComInfo docominfo;
|
|
|
private CapitalComInfo capitalcominfo;
|
|
|
private WorkflowRequestComInfo wfrequestcominfo;
|
|
|
private DocReceiveUnitComInfo docReceiveUnitComInfo;
|
|
|
private int Requestid;
|
|
|
private int Isprint;
|
|
|
private String iswfshare;
|
|
|
private User user;
|
|
|
private ArrayList SelectCancelValues;
|
|
|
private BaseBean wfsbean;
|
|
|
private DocComInfo docinf;
|
|
|
private int isfromMobile;
|
|
|
private int printModeId;
|
|
|
private List<Map<String,Object>> nodeMarkContent;
|
|
|
private int layoutNodeid = 0;
|
|
|
private int viewNodeidScope = 0;
|
|
|
private boolean isTableShow = false;//签字意见是否表格显示
|
|
|
private String tableContent = "";//表格内签字意见内容(除去表头和表尾)
|
|
|
private String lastTableContent = "";//多个签字意见放同一个单元格时,上一个单元格的tableContent,共用同一个表格
|
|
|
private MainSubSignEntity mainSubSignEntity;
|
|
|
private int remarkRequestid;// 签字意见的流程requestid
|
|
|
|
|
|
public FieldInfo() {
|
|
|
ManTableFields = new ArrayList();
|
|
|
ManTableFieldValues = new ArrayList();
|
|
|
ManTableFieldNames = new ArrayList();
|
|
|
ManTableFieldFieldNames = new ArrayList();
|
|
|
ManTableFieldDBTypes = new ArrayList();
|
|
|
DetailTableFields = new ArrayList();
|
|
|
DetailTableFieldValues = new ArrayList();
|
|
|
DetailFieldIsViews = new ArrayList();
|
|
|
DetailTableFieldNames = new ArrayList();
|
|
|
DetailTableFieldIds = new ArrayList();
|
|
|
DetailTableIds = new ArrayList();
|
|
|
DetailFieldDBTypes = new ArrayList();
|
|
|
DetailDBFieldNames = new ArrayList();
|
|
|
ManTableChildFields = new ArrayList();
|
|
|
DetailTableChildFields = new ArrayList();
|
|
|
Nodes = new ArrayList();
|
|
|
NodeNames = new ArrayList();
|
|
|
ManUrlList = new ArrayList();
|
|
|
ManUrlLinkList = new ArrayList();
|
|
|
DetailUrlList = new ArrayList();
|
|
|
DetailUrlLinkList = new ArrayList();
|
|
|
DetailTableNames = new ArrayList();
|
|
|
DetailTableKeys = new ArrayList();
|
|
|
SelectItems = new ArrayList();
|
|
|
SelectItemValues = new ArrayList();
|
|
|
SelectDefaults = new ArrayList();
|
|
|
user = null;
|
|
|
SelectCancelValues = new ArrayList();
|
|
|
workflowNodeComInfo = new WorkflowNodeComInfo();
|
|
|
try {
|
|
|
urlcominfo = new BrowserComInfo();
|
|
|
resourcecominfo = new ResourceComInfo();
|
|
|
jobComInfo = new JobTitlesComInfo();
|
|
|
prjcominfo = new ProjectInfoComInfo();
|
|
|
crmcominfo = new CustomerInfoComInfo();
|
|
|
orgShowBiz = new OrganizationShowSetBiz();
|
|
|
deptVirComInfo = new DepartmentVirtualComInfo();
|
|
|
subcomcominfo = new SubCompanyComInfo();
|
|
|
subCompVirComInfo = new SubCompanyVirtualComInfo();
|
|
|
docominfo = new DocComInfo();
|
|
|
capitalcominfo = new CapitalComInfo();
|
|
|
wfrequestcominfo = new WorkflowRequestComInfo();
|
|
|
docReceiveUnitComInfo = new DocReceiveUnitComInfo();
|
|
|
wfsbean = new BaseBean();
|
|
|
docinf = new DocComInfo();
|
|
|
mainSubSignEntity = new MainSubSignEntity();
|
|
|
} catch (Exception e) {
|
|
|
}
|
|
|
Requestid = 0;
|
|
|
iswfshare = "";
|
|
|
isfromMobile = 0;
|
|
|
}
|
|
|
|
|
|
public void initMainSubCfg(String efieldid) throws Exception{
|
|
|
//新增平行流程意见
|
|
|
if(efieldid.endsWith("_2") || efieldid.endsWith("_3") || efieldid.endsWith("_4")){ //标识是取主子流程意见
|
|
|
String[] arr = efieldid.split("_");
|
|
|
new BaseBean().writeLog("主子流程和平行流程efieldid:"+efieldid+" arr:"+JSON.toJSONString(arr));
|
|
|
if(arr.length == 3){
|
|
|
this.mainSubSignEntity.setWfid(Util.getIntValue(arr[0], 0));
|
|
|
this.mainSubSignEntity.setNodeid(Util.getIntValue(arr[1], 0));
|
|
|
this.mainSubSignEntity.setType(Util.getIntValue(arr[2], 0));
|
|
|
}else{
|
|
|
throw new Exception("主子流程节点设置存在异常");
|
|
|
}
|
|
|
}else{
|
|
|
this.mainSubSignEntity.setWfid(0);
|
|
|
this.mainSubSignEntity.setNodeid(0);
|
|
|
this.mainSubSignEntity.setType(0);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public MainSubSignEntity getMainSubSignEntity() {
|
|
|
return mainSubSignEntity;
|
|
|
}
|
|
|
|
|
|
public int getIsfromMobile() {
|
|
|
return isfromMobile;
|
|
|
}
|
|
|
|
|
|
|
|
|
public void setIsfromMobile(int isfromMobile) {
|
|
|
this.isfromMobile = isfromMobile;
|
|
|
}
|
|
|
|
|
|
public boolean isTableShow() {
|
|
|
return isTableShow;
|
|
|
}
|
|
|
|
|
|
public void setTableShow(boolean tableShow) {
|
|
|
isTableShow = tableShow;
|
|
|
}
|
|
|
|
|
|
public String getTableContent() {
|
|
|
return tableContent;
|
|
|
}
|
|
|
|
|
|
public void setTableContent(String tableContent) {
|
|
|
this.tableContent = tableContent;
|
|
|
}
|
|
|
|
|
|
public String getLastTableContent() {
|
|
|
return lastTableContent;
|
|
|
}
|
|
|
|
|
|
public void setLastTableContent(String lastTableContent) {
|
|
|
this.lastTableContent = lastTableContent;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到封存选项
|
|
|
*
|
|
|
* @return 得到封存选项
|
|
|
*/
|
|
|
public ArrayList getSelectCancelValues() {
|
|
|
return SelectCancelValues;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获得BaseBean
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public BaseBean getWfsbean() {
|
|
|
if (wfsbean == null) {
|
|
|
wfsbean = new BaseBean();
|
|
|
}
|
|
|
return wfsbean;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到缺省被选项
|
|
|
*
|
|
|
* @return 缺省被选项
|
|
|
*/
|
|
|
public ArrayList getSelectDefaults() {
|
|
|
return SelectDefaults;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到选择下拉框的值
|
|
|
*
|
|
|
* @return 选择下拉框的值
|
|
|
*/
|
|
|
public ArrayList getSelectItemValues() {
|
|
|
return SelectItemValues;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到下拉框选择项
|
|
|
*
|
|
|
* @return 下拉框选择项
|
|
|
*/
|
|
|
public ArrayList getSelectItems() {
|
|
|
return SelectItems;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到明细单据的和主表的关联字段
|
|
|
*
|
|
|
* @return 明细单据的和主表的关联字段
|
|
|
*/
|
|
|
public ArrayList getDetailTableKeys() {
|
|
|
return DetailTableKeys;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到明细单据表名
|
|
|
*
|
|
|
* @return 明细单据表名
|
|
|
*/
|
|
|
public ArrayList getDetailTableNames() {
|
|
|
return DetailTableNames;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到明细单据的字段名
|
|
|
*
|
|
|
* @return 明细单据的字段名
|
|
|
*/
|
|
|
public ArrayList getDetailDBFieldNames() {
|
|
|
return DetailDBFieldNames;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到明细单据的字段数据类型
|
|
|
*
|
|
|
* @return 明细单据的字段数据类型
|
|
|
*/
|
|
|
public ArrayList getDetailFieldDBTypes() {
|
|
|
return DetailFieldDBTypes;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到明细单据的字段ID
|
|
|
*
|
|
|
* @return 字段ID
|
|
|
*/
|
|
|
public ArrayList getDetailTableFieldIds() {
|
|
|
return DetailTableFieldIds;
|
|
|
}
|
|
|
|
|
|
public HttpServletRequest getRequest() {
|
|
|
return request;
|
|
|
}
|
|
|
|
|
|
public void setRequest(HttpServletRequest request) {
|
|
|
this.request = request;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到明细单据的明细行ID
|
|
|
*
|
|
|
* @return 明细行ID
|
|
|
*/
|
|
|
public ArrayList getDetailTableIds() {
|
|
|
return DetailTableIds;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到请求ID
|
|
|
*
|
|
|
* @return 请求ID
|
|
|
*/
|
|
|
public int getRequestid() {
|
|
|
return Requestid;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 设置请求ID
|
|
|
*
|
|
|
* @param requestid 请求ID
|
|
|
*/
|
|
|
public void setRequestid(int requestid) {
|
|
|
Requestid = requestid;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 设置用户对象
|
|
|
*
|
|
|
* @param paraValue 请求ID
|
|
|
*/
|
|
|
public void setUser(User paraValue) {
|
|
|
user = paraValue;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到主字段值
|
|
|
*
|
|
|
* @return 主字段值
|
|
|
*/
|
|
|
public ArrayList getManTableFieldValues() {
|
|
|
return ManTableFieldValues;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到明细表字段值
|
|
|
*
|
|
|
* @return 明细表字段值
|
|
|
*/
|
|
|
public ArrayList getDetailTableFieldValues() {
|
|
|
return DetailTableFieldValues;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到明细表字段值
|
|
|
*
|
|
|
* @return 明细表字段值
|
|
|
*/
|
|
|
public ArrayList getDetailFieldIsViews() {
|
|
|
return DetailFieldIsViews;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到主表BROSWER字段的选择框页面地址
|
|
|
*
|
|
|
* @return 主表BROSWER字段的选择框页面地址
|
|
|
*/
|
|
|
public ArrayList getManUrlList() {
|
|
|
return ManUrlList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到主表BROSWER字段的内容浏览页面地址
|
|
|
*
|
|
|
* @return 主表BROSWER字段的内容浏览页面地址
|
|
|
*/
|
|
|
public ArrayList getManUrlLinkList() {
|
|
|
return ManUrlLinkList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到明细表BROSWER字段的选择框页面地址
|
|
|
*
|
|
|
* @return 主表BROSWER字段的选择框页面地址
|
|
|
*/
|
|
|
public ArrayList getDetailUrlList() {
|
|
|
return DetailUrlList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到明细表BROSWER字段的内容浏览页面地址
|
|
|
*
|
|
|
* @return 主表BROSWER字段的内容浏览页面地址
|
|
|
*/
|
|
|
public ArrayList getDetailUrlLinkList() {
|
|
|
return DetailUrlLinkList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到明细表字段集合
|
|
|
*
|
|
|
* @return 明细表字段集合
|
|
|
*/
|
|
|
public ArrayList getDetailTableFields() {
|
|
|
return DetailTableFields;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到明细表字段名称集合
|
|
|
*
|
|
|
* @return 明细表字段名称集合
|
|
|
*/
|
|
|
public ArrayList getDetailTableFieldNames() {
|
|
|
return DetailTableFieldNames;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到节点集合
|
|
|
*
|
|
|
* @return 节点集合
|
|
|
*/
|
|
|
public ArrayList getNodes() {
|
|
|
return Nodes;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到节点名称集合
|
|
|
*
|
|
|
* @return 节点名称集合
|
|
|
*/
|
|
|
public ArrayList getNodeNames() {
|
|
|
return NodeNames;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到主表字段集合
|
|
|
*
|
|
|
* @return 主表字段集合
|
|
|
*/
|
|
|
public ArrayList getManTableFields() {
|
|
|
return ManTableFields;
|
|
|
}
|
|
|
|
|
|
public Map<String, String> getMainFieldValues() {
|
|
|
return mapMainTblFields;
|
|
|
}
|
|
|
|
|
|
public List getDetailFieldValues() {
|
|
|
return lstDetailTblFields;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到主表字段名称集合
|
|
|
*
|
|
|
* @return 主表字段名称集合
|
|
|
*/
|
|
|
public ArrayList getManTableFieldNames() {
|
|
|
return ManTableFieldNames;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到主表字段字段名称集合
|
|
|
*
|
|
|
* @return 主表字段字段名称集合
|
|
|
*/
|
|
|
public ArrayList getManTableFieldFieldNames() {
|
|
|
return ManTableFieldFieldNames;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到主字段的数据类型集合
|
|
|
*
|
|
|
* @return 主字段的数据类型集合
|
|
|
*/
|
|
|
public ArrayList getManTableFieldDBTypes() {
|
|
|
return ManTableFieldDBTypes;
|
|
|
}
|
|
|
|
|
|
public int getIsprint() {
|
|
|
return Isprint;
|
|
|
}
|
|
|
|
|
|
public void setIsprint(int print) {
|
|
|
Isprint = print;
|
|
|
}
|
|
|
|
|
|
public int getPrintModeId() {
|
|
|
return printModeId;
|
|
|
}
|
|
|
|
|
|
public void setPrintModeId(int printModeId) {
|
|
|
this.printModeId = printModeId;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 取得主表的字段信息
|
|
|
*
|
|
|
* @param formid 表单/单据ID
|
|
|
* @param isbill 是否单据
|
|
|
* @param languageid 显示语言
|
|
|
*/
|
|
|
public void GetManTableField(int formid, int isbill, int languageid) {
|
|
|
String linkaddress = "";
|
|
|
String id = "";
|
|
|
String fieldvalue = "";
|
|
|
String type = "";
|
|
|
String fielddbtype = "";
|
|
|
int htmltype = 1;
|
|
|
int childfieldid = 0;
|
|
|
RecordSet rs1 = new RecordSet();
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String sql = "";
|
|
|
String fieldnames = "";
|
|
|
//表单
|
|
|
if (isbill == 0) {
|
|
|
rs.executeSql("select b.id,b.fieldhtmltype,b.type,b.fielddbtype,c.fieldlable,b.fieldname,b.childfieldid from workflow_formfield a,workflow_formdict b,workflow_fieldlable c where a.formid=c.formid and a.fieldid=c.fieldid and c.langurageid=" + languageid + " and a.formid=" + formid + " and a.fieldid=b.id and a.isdetail is null order by a.fieldorder");
|
|
|
|
|
|
List<String> lstFieldIds = new ArrayList<String>();
|
|
|
while (rs.next()) {
|
|
|
fieldvalue = "";
|
|
|
linkaddress = "";
|
|
|
id = rs.getString("id");
|
|
|
type = rs.getString("type");
|
|
|
htmltype = rs.getInt("fieldhtmltype");
|
|
|
fielddbtype = rs.getString("fielddbtype");
|
|
|
String fieldname = rs.getString("fieldname");
|
|
|
childfieldid = Util.getIntValue(rs.getString("childfieldid"), 0);
|
|
|
if (htmltype == 7) {
|
|
|
sql = "select * from workflow_specialfield where fieldid = " + id + " and isform = 1";
|
|
|
rs1.executeSql(sql);
|
|
|
if (rs1.next()) {
|
|
|
if (type.equals("2")) fieldvalue = rs1.getString("descriptivetext");
|
|
|
if (type.equals("1")) fieldvalue = rs1.getString("displayname");
|
|
|
linkaddress = Util.null2String(rs1.getString("linkaddress"));
|
|
|
}
|
|
|
} else {
|
|
|
if (fieldnames.equals("")) {
|
|
|
fieldnames = fieldname;
|
|
|
} else {
|
|
|
fieldnames += "," + fieldname;
|
|
|
}
|
|
|
}
|
|
|
if (htmltype == 3) {
|
|
|
if (type.equals("161") || type.equals("162") || type.equals("224") || type.equals("225"))
|
|
|
ManUrlList.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype);
|
|
|
else if (type.equals("256") || type.equals("257"))
|
|
|
ManUrlList.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype + "_" + type);
|
|
|
else
|
|
|
ManUrlList.add(urlcominfo.getBrowserurl(type));
|
|
|
ManUrlLinkList.add(urlcominfo.getLinkurl(type));
|
|
|
} else if (htmltype == 7 && type.equals("1")) {
|
|
|
ManUrlList.add("");
|
|
|
ManUrlLinkList.add(linkaddress);
|
|
|
} else {
|
|
|
ManUrlList.add("");
|
|
|
ManUrlLinkList.add("");
|
|
|
}
|
|
|
if (htmltype == 3 && (type.equals("224") || type.equals("225"))) { // sap自定义浏览按钮
|
|
|
fielddbtype = "varchar2(1000)";
|
|
|
if (type.equals("225")) {
|
|
|
fielddbtype = "varchar2(4000)";
|
|
|
}
|
|
|
}
|
|
|
ManTableFieldValues.add(fieldvalue);
|
|
|
ManTableFields.add("field" + id + "_" + type + "_" + htmltype);
|
|
|
ManTableFieldNames.add(rs.getString("fieldlable"));
|
|
|
ManTableFieldFieldNames.add(fieldname);
|
|
|
ManTableFieldDBTypes.add(fielddbtype);
|
|
|
ManTableChildFields.add("" + childfieldid);
|
|
|
lstFieldIds.add(id);
|
|
|
}
|
|
|
if (Requestid > 0 && !fieldnames.equals("")) {
|
|
|
sql = "select " + fieldnames + " from workflow_form where Requestid=" + Requestid;
|
|
|
rs1.executeSql(sql);
|
|
|
String[] colnames = rs1.getColumnName();
|
|
|
if (rs1.next()) {
|
|
|
for (int i = 0; i < colnames.length; i++) {
|
|
|
//int indx=ManTableFieldFieldNames.indexOf(colnames[i]);
|
|
|
int indx = Util.getListIndex(ManTableFieldFieldNames, colnames[i]);
|
|
|
if (indx > -1) {
|
|
|
fieldvalue = rs1.getString(colnames[i]);
|
|
|
ManTableFieldValues.set(indx, fieldvalue);
|
|
|
String fieldID = lstFieldIds.get(indx);
|
|
|
mapMainTblFields.put(fieldID, fieldvalue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//单据
|
|
|
if (isbill == 1) {
|
|
|
rs.executeSql("select id,labelname,fieldhtmltype,type,fielddbtype,fieldname,childfieldid from workflow_billfield,HtmlLabelInfo where fieldlabel=indexid and languageid=" + languageid + " and billid=" + formid + " and viewtype=0 order by dsporder");
|
|
|
|
|
|
List<String> lstFieldIds = new ArrayList<String>();
|
|
|
while (rs.next()) {
|
|
|
fieldvalue = "";
|
|
|
linkaddress = "";
|
|
|
id = rs.getString("id");
|
|
|
type = rs.getString("type");
|
|
|
fielddbtype = rs.getString("fielddbtype");
|
|
|
htmltype = rs.getInt("fieldhtmltype");
|
|
|
String fieldname = rs.getString("fieldname");
|
|
|
childfieldid = Util.getIntValue(rs.getString("childfieldid"), 0);
|
|
|
|
|
|
if (htmltype == 7) {
|
|
|
sql = "select * from workflow_specialfield where fieldid = " + id + " and isbill = 1";
|
|
|
rs1.executeSql(sql);
|
|
|
if (rs1.next()) {
|
|
|
if (type.equals("2")) fieldvalue = rs1.getString("descriptivetext");
|
|
|
if (type.equals("1")) fieldvalue = rs1.getString("displayname");
|
|
|
linkaddress = Util.null2String(rs1.getString("linkaddress"));
|
|
|
}
|
|
|
} else {
|
|
|
if (fieldnames.equals("")) {
|
|
|
fieldnames = fieldname;
|
|
|
} else {
|
|
|
fieldnames += "," + fieldname;
|
|
|
}
|
|
|
}
|
|
|
if (htmltype == 3) {
|
|
|
if (type.equals("161") || type.equals("162") || type.equals("224") || type.equals("225"))
|
|
|
ManUrlList.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype);
|
|
|
else if (type.equals("256") || type.equals("257"))
|
|
|
ManUrlList.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype + "_" + type);
|
|
|
else
|
|
|
ManUrlList.add(urlcominfo.getBrowserurl(type));
|
|
|
ManUrlLinkList.add(urlcominfo.getLinkurl(type));
|
|
|
} else if (htmltype == 7 && type.equals("1")) {
|
|
|
ManUrlList.add("");
|
|
|
ManUrlLinkList.add(linkaddress);
|
|
|
} else {
|
|
|
ManUrlList.add("");
|
|
|
ManUrlLinkList.add("");
|
|
|
}
|
|
|
if (htmltype == 3 && (type.equals("224") || type.equals("225"))) { // sap自定义浏览按钮
|
|
|
fielddbtype = "varchar2(1000)";
|
|
|
if (type.equals("225")) {
|
|
|
fielddbtype = "varchar2(4000)";
|
|
|
}
|
|
|
}
|
|
|
ManTableFieldValues.add(fieldvalue);
|
|
|
ManTableFields.add("field" + id + "_" + type + "_" + htmltype);
|
|
|
ManTableFieldNames.add(rs.getString("labelname"));
|
|
|
ManTableFieldFieldNames.add(fieldname);
|
|
|
ManTableFieldDBTypes.add(fielddbtype);
|
|
|
ManTableChildFields.add("" + childfieldid);
|
|
|
lstFieldIds.add(id);
|
|
|
}
|
|
|
if (Requestid > 0) {
|
|
|
String tablename = "";
|
|
|
sql = "select tablename from workflow_bill where id=" + formid;
|
|
|
rs1.executeSql(sql);
|
|
|
if (rs1.next()) {
|
|
|
tablename = rs1.getString("tablename");
|
|
|
sql = "select " + fieldnames + " from " + tablename + " where requestid = " + Requestid;
|
|
|
rs1.executeSql(sql);
|
|
|
String[] colnames = rs1.getColumnName();
|
|
|
if (rs1.next()) {
|
|
|
for (int i = 0; i < colnames.length; i++) {
|
|
|
//int indx = ManTableFieldFieldNames.indexOf(colnames[i]);
|
|
|
//Linux+Oarcle下,colnames[i]全大写
|
|
|
int indx = Util.getListIndex(ManTableFieldFieldNames, colnames[i]);
|
|
|
if (indx > -1) {
|
|
|
fieldvalue = rs1.getString(colnames[i]);
|
|
|
ManTableFieldValues.set(indx, fieldvalue);
|
|
|
String fieldID = lstFieldIds.get(indx);
|
|
|
mapMainTblFields.put(fieldID, fieldvalue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 取得明细表的字段信息
|
|
|
*
|
|
|
* @param formid 表单/单据ID
|
|
|
* @param isbill 是否单据
|
|
|
* @param languageid 显示语言
|
|
|
*/
|
|
|
public void GetDetailTableField(int formid, int isbill, int languageid){
|
|
|
GetDetailTableField(formid, isbill, languageid, false);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取明细表数据,支持排序
|
|
|
* @param formid
|
|
|
* @param isbill
|
|
|
* @param languageid
|
|
|
*/
|
|
|
public void getDetailTableFieldWithSort(int formid, int isbill, int languageid,String workflowId,String nodeId){
|
|
|
getDetailTableFieldWithSort(formid, isbill, languageid, false,workflowId,nodeId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取明细表数据,支持排序
|
|
|
* @param formid
|
|
|
* @param isbill
|
|
|
* @param languageid
|
|
|
*/
|
|
|
|
|
|
public void getDetailTableFieldWithSort(int formid, int isbill, int languageid, boolean buildEmptyDetail,String workflowid,String nodeid) {
|
|
|
|
|
|
DetailOrderManager detailOrderManager = new DetailOrderManager();
|
|
|
|
|
|
RecordSet rs1 = new RecordSet();
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String id = "";
|
|
|
String type = "";
|
|
|
int htmltype = 1;
|
|
|
String fieldvalue = "";
|
|
|
String fielddbtype = "";
|
|
|
String isview = "";
|
|
|
int childfieldid = 0;
|
|
|
RecordSet rs2 = new RecordSet();
|
|
|
String sql = "";
|
|
|
WFLinkInfo wfinf = new WFLinkInfo();
|
|
|
int userid = 0;
|
|
|
int logintype = 1;
|
|
|
if (user != null) {
|
|
|
userid = user.getUID();
|
|
|
logintype = Util.getIntValue(user.getLogintype(), 1);
|
|
|
}
|
|
|
int currentnodeid = wfinf.getCurrentNodeid(Requestid, userid, logintype);
|
|
|
//表单
|
|
|
if (isbill == 0) {
|
|
|
|
|
|
int groupId =1;
|
|
|
rs2.execute("select distinct groupId from workflow_formfield where formid=" + formid + " and isdetail='1' order by groupId");
|
|
|
while (rs2.next()) {
|
|
|
|
|
|
String orderSql = detailOrderManager.getOrderSql(workflowid, nodeid, formid+"", isbill+"", String.valueOf(languageid), groupId + "", " ", "b","id");
|
|
|
|
|
|
ArrayList detailfieldtypes = new ArrayList();
|
|
|
ArrayList detaildbfnames = new ArrayList();
|
|
|
ArrayList detailfields = new ArrayList();
|
|
|
ArrayList detialfieldnames = new ArrayList();
|
|
|
ArrayList detailurls = new ArrayList();
|
|
|
ArrayList detailurllinks = new ArrayList();
|
|
|
ArrayList detailfieldvalues = new ArrayList();
|
|
|
ArrayList detailfieldids = new ArrayList();
|
|
|
ArrayList detailids = new ArrayList();
|
|
|
ArrayList detailisviews = new ArrayList();
|
|
|
ArrayList detailchildfieldids = new ArrayList();
|
|
|
rs.executeSql("select b.id from Workflow_formdetail b where b.Requestid=" + Requestid + " and b.groupId=" + rs2.getInt(1) + " order by " + orderSql);
|
|
|
while (rs.next()) {
|
|
|
detailids.add(rs.getString("id"));
|
|
|
}
|
|
|
String fieldnames = "";
|
|
|
rs.executeSql("select b.id,b.fieldhtmltype,c.fieldlable,b.type,b.fieldname,b.fielddbtype,b.childfieldid from workflow_formfield a,workflow_formdictdetail b,workflow_fieldlable c where a.formid=c.formid and a.fieldid=c.fieldid and c.langurageid=" + languageid + " and a.formid=" + formid + " and a.groupId=" + rs2.getInt(1) + " and a.fieldid=b.id and a.isdetail='1' order by a.fieldorder");
|
|
|
while (rs.next()) {
|
|
|
id = rs.getString("id");
|
|
|
type = rs.getString("type");
|
|
|
htmltype = rs.getInt("fieldhtmltype");
|
|
|
String fieldname = rs.getString("fieldname");
|
|
|
fielddbtype = rs.getString("fielddbtype");
|
|
|
childfieldid = Util.getIntValue(rs.getString("childfieldid"), 0);
|
|
|
sql = "select isview from workflow_modeview where nodeid=" + currentnodeid + " and formid=" + formid + " and isbill=0 and fieldid=" + id;
|
|
|
rs1.execute(sql);
|
|
|
if (rs1.next() && rs1.getInt("isview") == 1) {
|
|
|
isview = "1";
|
|
|
} else {
|
|
|
isview = "";
|
|
|
}
|
|
|
if (fieldnames.equals("")) {
|
|
|
fieldnames = "b." + fieldname;
|
|
|
} else {
|
|
|
fieldnames += "," + "b." + fieldname;
|
|
|
}
|
|
|
if (htmltype == 3) {
|
|
|
if (type.equals("161") || type.equals("162") || type.equals("224") || type.equals("225"))
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype);
|
|
|
else if (type.equals("256") || type.equals("257"))
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype + "_" + type);
|
|
|
else
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type));
|
|
|
detailurllinks.add(urlcominfo.getLinkurl(type));
|
|
|
} else {
|
|
|
detailurls.add("");
|
|
|
detailurllinks.add("");
|
|
|
}
|
|
|
if (htmltype == 3 && (type.equals("224") || type.equals("225"))) { // sap自定义浏览按钮
|
|
|
fielddbtype = "varchar2(1000)";
|
|
|
if (type.equals("225")) {
|
|
|
fielddbtype = "varchar2(4000)";
|
|
|
}
|
|
|
}
|
|
|
detailfieldids.add(new ArrayList());
|
|
|
detailfieldvalues.add(new ArrayList());
|
|
|
detailfieldtypes.add(fielddbtype);
|
|
|
detaildbfnames.add(fieldname);
|
|
|
detailisviews.add(isview);
|
|
|
detailfields.add("field" + id + "_0_" + type + "_" + htmltype);
|
|
|
detialfieldnames.add(rs.getString("fieldlable"));
|
|
|
detailchildfieldids.add("" + childfieldid);
|
|
|
}
|
|
|
if (Requestid > 0) {
|
|
|
sql = "select " + fieldnames + " from Workflow_formdetail b where b.Requestid=" + Requestid + " and b.groupId=" + rs2.getInt(1) + " order by " + orderSql;
|
|
|
rs1.executeSql(sql);
|
|
|
String[] colnames = rs1.getColumnName();
|
|
|
for (int k = 0; k < colnames.length; k++) {
|
|
|
int indx = Util.getListIndex(detaildbfnames, colnames[k]);
|
|
|
if (indx > -1) {
|
|
|
ArrayList detailvalues = new ArrayList();
|
|
|
ArrayList detailfieldid = new ArrayList();
|
|
|
String detailfield = (String) detailfields.get(indx);
|
|
|
rs1.beforFirst();
|
|
|
int i = 0;
|
|
|
while (rs1.next()) {
|
|
|
fieldvalue = rs1.getString(colnames[k]);
|
|
|
detailvalues.add(fieldvalue);
|
|
|
detailfieldid.add(Util.StringReplaceOnce(detailfield, "_0_", "_" + i + "_"));
|
|
|
i++;
|
|
|
}
|
|
|
detailfieldids.set(indx, detailfieldid);
|
|
|
detailfieldvalues.set(indx, detailvalues);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (detailfields.size() > 0) {
|
|
|
DetailTableFields.add(detailfields);
|
|
|
DetailTableFieldValues.add(detailfieldvalues);
|
|
|
DetailTableFieldNames.add(detialfieldnames);
|
|
|
DetailTableFieldIds.add(detailfieldids);
|
|
|
DetailFieldIsViews.add(detailisviews);
|
|
|
DetailTableIds.add(detailids);
|
|
|
DetailUrlList.add(detailurls);
|
|
|
DetailUrlLinkList.add(detailurllinks);
|
|
|
DetailFieldDBTypes.add(detailfieldtypes);
|
|
|
DetailDBFieldNames.add(detaildbfnames);
|
|
|
DetailTableChildFields.add(detailchildfieldids);
|
|
|
}
|
|
|
groupId ++;
|
|
|
}
|
|
|
}
|
|
|
//单据
|
|
|
if (isbill == 1) {
|
|
|
String detailtable = "";
|
|
|
String maintable = "";
|
|
|
String keyfield = "";
|
|
|
String tempdetailtable = "";
|
|
|
rs.executeSql(" select tablename,detailkeyfield,detailtablename from Workflow_bill where id=" + formid);
|
|
|
if (rs.next()) {
|
|
|
maintable = rs.getString("tablename");
|
|
|
keyfield = rs.getString("detailkeyfield");
|
|
|
tempdetailtable = rs.getString("detailtablename");
|
|
|
if (keyfield == null || keyfield.trim().equals("")) {
|
|
|
keyfield = "mainid";
|
|
|
}
|
|
|
}
|
|
|
if (maintable != null && !maintable.trim().equals("")) {
|
|
|
ArrayList detailtablelist = new ArrayList();
|
|
|
String detailtables = "";
|
|
|
rs1.executeSql("select detailtable from workflow_billfield where billid=" + formid + " and viewtype=1 group by detailtable");
|
|
|
while (rs1.next()) {
|
|
|
String detailtemp = rs1.getString("detailtable");
|
|
|
if (detailtables.equals("")) {
|
|
|
if (detailtemp == null || detailtemp.trim().equals("")) {
|
|
|
detailtables = "null,''";
|
|
|
} else {
|
|
|
detailtables = "'" + detailtemp + "'";
|
|
|
}
|
|
|
} else {
|
|
|
if (detailtemp == null || detailtemp.trim().equals("")) {
|
|
|
detailtables += ",null,''";
|
|
|
} else {
|
|
|
detailtables += ",'" + detailtemp + "'";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (detailtables.length() > 0) {
|
|
|
String emptySqlStr = buildEmptyDetail ? "" : " and tablename in(" + detailtables + ")";
|
|
|
rs1.executeSql("select tablename from WORKFLOW_BILLDETAILTABLE where billid=" + formid + " "+emptySqlStr+" order by orderid");
|
|
|
while (rs1.next()) {
|
|
|
detailtablelist.add(rs1.getString("tablename"));
|
|
|
}
|
|
|
}
|
|
|
if (detailtablelist.size() < 1 && tempdetailtable.length() > 0) {
|
|
|
detailtablelist.add("");
|
|
|
}
|
|
|
int groupId = 1;
|
|
|
for (int deno = 0; deno < detailtablelist.size(); deno++) {
|
|
|
String fieldnames = "";
|
|
|
detailtable = (String) detailtablelist.get(deno);
|
|
|
if (detailtable == null || detailtable.trim().equals("")) {
|
|
|
sql = "select id,labelname,fieldhtmltype,type,fieldname,fielddbtype,childfieldid from workflow_billfield,HtmlLabelInfo where fieldlabel=indexid and languageid=" + languageid + " and billid=" + formid + " and (detailtable is null or detailtable='" + detailtable + "') and viewtype=1 order by dsporder";
|
|
|
detailtable = tempdetailtable;
|
|
|
} else {
|
|
|
sql = "select id,labelname,fieldhtmltype,type,fieldname,fielddbtype,childfieldid from workflow_billfield,HtmlLabelInfo where fieldlabel=indexid and languageid=" + languageid + " and billid=" + formid + " and detailtable='" + detailtable + "' and viewtype=1 order by dsporder";
|
|
|
}
|
|
|
|
|
|
String orderSql = detailOrderManager.getOrderSql(workflowid, nodeid, formid+"", isbill+"", String.valueOf(languageid), groupId + "", detailtable, "b","id");
|
|
|
|
|
|
ArrayList detailfieldtypes = new ArrayList();
|
|
|
ArrayList detaildbfnames = new ArrayList();
|
|
|
ArrayList detailfields = new ArrayList();
|
|
|
ArrayList detialfieldnames = new ArrayList();
|
|
|
ArrayList detailurls = new ArrayList();
|
|
|
ArrayList detailurllinks = new ArrayList();
|
|
|
ArrayList detailfieldvalues = new ArrayList();
|
|
|
ArrayList detailisviews = new ArrayList();
|
|
|
ArrayList detailfieldids = new ArrayList();
|
|
|
ArrayList detailids = new ArrayList();
|
|
|
ArrayList detailchildfieldids = new ArrayList();
|
|
|
/* if (formid == 201) {
|
|
|
sql = "select id,labelname,fieldhtmltype,type,fieldname,fielddbtype,childfieldid from workflow_billfield ,HtmlLabelInfo where fieldlabel=indexid and languageid=" + languageid + " and billid=" + formid + " and viewtype=1 order by dsporder";
|
|
|
}*/
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
id = rs.getString("id");
|
|
|
type = rs.getString("type");
|
|
|
htmltype = rs.getInt("fieldhtmltype");
|
|
|
String fieldname = rs.getString("fieldname");
|
|
|
fielddbtype = rs.getString("fielddbtype");
|
|
|
childfieldid = Util.getIntValue(rs.getString("childfieldid"), 0);
|
|
|
sql = "select isview from workflow_modeview where nodeid=" + currentnodeid + " and formid=" + formid + " and isbill=1 and fieldid=" + id;
|
|
|
rs1.execute(sql);
|
|
|
if (rs1.next() && rs1.getInt("isview") == 1) {
|
|
|
isview = "1";
|
|
|
} else {
|
|
|
isview = "";
|
|
|
}
|
|
|
if (fieldnames.equals("")) {
|
|
|
fieldnames = "b." + fieldname;
|
|
|
} else {
|
|
|
fieldnames += ",b." + fieldname;
|
|
|
}
|
|
|
if (htmltype == 3) {
|
|
|
if (type.equals("161") || type.equals("162") || type.equals("224") || type.equals("225"))
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype);
|
|
|
else if (type.equals("256") || type.equals("257"))
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype + "_" + type);
|
|
|
else
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type));
|
|
|
detailurllinks.add(urlcominfo.getLinkurl(type));
|
|
|
} else {
|
|
|
detailurls.add("");
|
|
|
detailurllinks.add("");
|
|
|
}
|
|
|
if (htmltype == 3 && (type.equals("224") || type.equals("225"))) { // sap自定义浏览按钮
|
|
|
fielddbtype = "varchar2(1000)";
|
|
|
if (type.equals("225")) {
|
|
|
fielddbtype = "varchar2(4000)";
|
|
|
}
|
|
|
}
|
|
|
detailfieldids.add(new ArrayList());
|
|
|
detailfieldvalues.add(new ArrayList());
|
|
|
detailfieldtypes.add(fielddbtype);
|
|
|
detaildbfnames.add(fieldname);
|
|
|
detailisviews.add(isview);
|
|
|
detailfields.add("field" + id + "_0_" + type + "_" + htmltype);
|
|
|
detialfieldnames.add(rs.getString("labelname"));
|
|
|
detailchildfieldids.add("" + childfieldid);
|
|
|
}
|
|
|
if (Requestid > 0) {
|
|
|
String detailid = "";
|
|
|
if (formid == 156 || formid == 157 || formid == 158 || formid == 159) {
|
|
|
detailid = "dsporder";
|
|
|
sql = "select b.dsporder";
|
|
|
if (!fieldnames.equals("")) sql += "," + fieldnames;
|
|
|
sql += " from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid + " order by b.dsporder";
|
|
|
} else if (formid == 7 || formid == 14 || formid == 18 || formid == 19 || formid == 201) {//费用报销单。 资产调拨单据
|
|
|
detailid = "id";
|
|
|
sql = "select b.* from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid + " order by b.id";
|
|
|
/*if (formid == 201) {
|
|
|
sql = "select b.* from bill_Discard_Detail b,bill_Discard a where a.requestid=b.detailrequestid and a.requestid=" + Requestid + " order by b.id ";
|
|
|
}*/
|
|
|
} else if ((maintable.indexOf("formtable_main_") == 0 || maintable.indexOf("uf_") == 0)
|
|
|
&& (detailtable.indexOf("formtable_main_") == 0 || detailtable.indexOf("uf_") == 0)) {//新表单,formid<0,所以与上面的不会冲突。
|
|
|
detailid = "id";
|
|
|
sql = "select b.id";
|
|
|
if (!fieldnames.equals("")) sql += "," + fieldnames;
|
|
|
sql += " from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid + " order by " + orderSql;
|
|
|
} else if (formid < 0) { //数据中心模块创建的明细报表
|
|
|
detailid = "inputid";
|
|
|
sql = "select b.inputid";
|
|
|
if (!fieldnames.equals("")) sql += "," + fieldnames;
|
|
|
sql += " from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid + " order by b.inputid";
|
|
|
} else {
|
|
|
detailid = "id";
|
|
|
sql = "select b.* from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid;
|
|
|
}
|
|
|
rs1.executeSql(sql);
|
|
|
String[] colnames = rs1.getColumnName();
|
|
|
for (int k = 0; k < colnames.length; k++) {
|
|
|
if (detailid.equalsIgnoreCase(colnames[k])) {
|
|
|
rs1.beforFirst();
|
|
|
while (rs1.next()) {
|
|
|
fieldvalue = rs1.getString(colnames[k]);
|
|
|
detailids.add(fieldvalue);
|
|
|
}
|
|
|
} else {
|
|
|
//int indx = detaildbfnames.indexOf(colnames[k]);
|
|
|
int indx = Util.getListIndex(detaildbfnames, colnames[k]);
|
|
|
if (indx > -1) {
|
|
|
ArrayList detailvalues = new ArrayList();
|
|
|
ArrayList detailfieldid = new ArrayList();
|
|
|
String detailfield = (String) detailfields.get(indx);
|
|
|
rs1.beforFirst();
|
|
|
int i = 0;
|
|
|
while (rs1.next()) {
|
|
|
fieldvalue = rs1.getString(colnames[k]);
|
|
|
detailvalues.add(fieldvalue);
|
|
|
detailfieldid.add(Util.StringReplaceOnce(detailfield, "_0_", "_" + i + "_"));
|
|
|
i++;
|
|
|
}
|
|
|
detailfieldids.set(indx, detailfieldid);
|
|
|
detailfieldvalues.set(indx, detailvalues);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (detailfields.size() > 0 || buildEmptyDetail) {
|
|
|
DetailTableFields.add(detailfields);
|
|
|
DetailTableFieldValues.add(detailfieldvalues);
|
|
|
DetailTableFieldNames.add(detialfieldnames);
|
|
|
DetailTableFieldIds.add(detailfieldids);
|
|
|
DetailFieldIsViews.add(detailisviews);
|
|
|
DetailTableIds.add(detailids);
|
|
|
DetailUrlList.add(detailurls);
|
|
|
DetailUrlLinkList.add(detailurllinks);
|
|
|
DetailFieldDBTypes.add(detailfieldtypes);
|
|
|
DetailDBFieldNames.add(detaildbfnames);
|
|
|
DetailTableNames.add(detailtable);
|
|
|
DetailTableKeys.add(keyfield);
|
|
|
DetailTableChildFields.add(detailchildfieldids);
|
|
|
}
|
|
|
groupId ++;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public void GetDetailTableField(int formid, int isbill, int languageid, boolean buildEmptyDetail) {
|
|
|
RecordSet rs1 = new RecordSet();
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String id = "";
|
|
|
String type = "";
|
|
|
int htmltype = 1;
|
|
|
String fieldvalue = "";
|
|
|
String fielddbtype = "";
|
|
|
String isview = "";
|
|
|
int childfieldid = 0;
|
|
|
RecordSet rs2 = new RecordSet();
|
|
|
String sql = "";
|
|
|
WFLinkInfo wfinf = new WFLinkInfo();
|
|
|
int userid = 0;
|
|
|
int logintype = 1;
|
|
|
if (user != null) {
|
|
|
userid = user.getUID();
|
|
|
logintype = Util.getIntValue(user.getLogintype(), 1);
|
|
|
}
|
|
|
int currentnodeid = wfinf.getCurrentNodeid(Requestid, userid, logintype);
|
|
|
//表单
|
|
|
if (isbill == 0) {
|
|
|
rs2.execute("select distinct groupId from workflow_formfield where formid=" + formid + " and isdetail='1' order by groupId");
|
|
|
while (rs2.next()) {
|
|
|
ArrayList detailfieldtypes = new ArrayList();
|
|
|
ArrayList detaildbfnames = new ArrayList();
|
|
|
ArrayList detailfields = new ArrayList();
|
|
|
ArrayList detialfieldnames = new ArrayList();
|
|
|
ArrayList detailurls = new ArrayList();
|
|
|
ArrayList detailurllinks = new ArrayList();
|
|
|
ArrayList detailfieldvalues = new ArrayList();
|
|
|
ArrayList detailfieldids = new ArrayList();
|
|
|
ArrayList detailids = new ArrayList();
|
|
|
ArrayList detailisviews = new ArrayList();
|
|
|
ArrayList detailchildfieldids = new ArrayList();
|
|
|
rs.executeSql("select id from Workflow_formdetail where Requestid=" + Requestid + " and groupId=" + rs2.getInt(1) + " order by id");
|
|
|
while (rs.next()) {
|
|
|
detailids.add(rs.getString("id"));
|
|
|
}
|
|
|
String fieldnames = "";
|
|
|
rs.executeSql("select b.id,b.fieldhtmltype,c.fieldlable,b.type,b.fieldname,b.fielddbtype,b.childfieldid from workflow_formfield a,workflow_formdictdetail b,workflow_fieldlable c where a.formid=c.formid and a.fieldid=c.fieldid and c.langurageid=" + languageid + " and a.formid=" + formid + " and a.groupId=" + rs2.getInt(1) + " and a.fieldid=b.id and a.isdetail='1' order by a.fieldorder");
|
|
|
while (rs.next()) {
|
|
|
id = rs.getString("id");
|
|
|
type = rs.getString("type");
|
|
|
htmltype = rs.getInt("fieldhtmltype");
|
|
|
String fieldname = rs.getString("fieldname");
|
|
|
fielddbtype = rs.getString("fielddbtype");
|
|
|
childfieldid = Util.getIntValue(rs.getString("childfieldid"), 0);
|
|
|
sql = "select isview from workflow_modeview where nodeid=" + currentnodeid + " and formid=" + formid + " and isbill=0 and fieldid=" + id;
|
|
|
rs1.execute(sql);
|
|
|
if (rs1.next() && rs1.getInt("isview") == 1) {
|
|
|
isview = "1";
|
|
|
} else {
|
|
|
isview = "";
|
|
|
}
|
|
|
if (fieldnames.equals("")) {
|
|
|
fieldnames = fieldname;
|
|
|
} else {
|
|
|
fieldnames += "," + fieldname;
|
|
|
}
|
|
|
if (htmltype == 3) {
|
|
|
if (type.equals("161") || type.equals("162") || type.equals("224") || type.equals("225"))
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype);
|
|
|
else if (type.equals("256") || type.equals("257"))
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype + "_" + type);
|
|
|
else
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type));
|
|
|
detailurllinks.add(urlcominfo.getLinkurl(type));
|
|
|
} else {
|
|
|
detailurls.add("");
|
|
|
detailurllinks.add("");
|
|
|
}
|
|
|
if (htmltype == 3 && (type.equals("224") || type.equals("225"))) { // sap自定义浏览按钮
|
|
|
fielddbtype = "varchar2(1000)";
|
|
|
if (type.equals("225")) {
|
|
|
fielddbtype = "varchar2(4000)";
|
|
|
}
|
|
|
}
|
|
|
detailfieldids.add(new ArrayList());
|
|
|
detailfieldvalues.add(new ArrayList());
|
|
|
detailfieldtypes.add(fielddbtype);
|
|
|
detaildbfnames.add(fieldname);
|
|
|
detailisviews.add(isview);
|
|
|
detailfields.add("field" + id + "_0_" + type + "_" + htmltype);
|
|
|
detialfieldnames.add(rs.getString("fieldlable"));
|
|
|
detailchildfieldids.add("" + childfieldid);
|
|
|
}
|
|
|
if (Requestid > 0) {
|
|
|
sql = "select " + fieldnames + " from Workflow_formdetail where Requestid=" + Requestid + " and groupId=" + rs2.getInt(1) + " order by id";
|
|
|
rs1.executeSql(sql);
|
|
|
String[] colnames = rs1.getColumnName();
|
|
|
for (int k = 0; k < colnames.length; k++) {
|
|
|
int indx = Util.getListIndex(detaildbfnames, colnames[k]);
|
|
|
if (indx > -1) {
|
|
|
ArrayList detailvalues = new ArrayList();
|
|
|
ArrayList detailfieldid = new ArrayList();
|
|
|
String detailfield = (String) detailfields.get(indx);
|
|
|
rs1.beforFirst();
|
|
|
int i = 0;
|
|
|
while (rs1.next()) {
|
|
|
fieldvalue = rs1.getString(colnames[k]);
|
|
|
detailvalues.add(fieldvalue);
|
|
|
detailfieldid.add(Util.StringReplaceOnce(detailfield, "_0_", "_" + i + "_"));
|
|
|
i++;
|
|
|
}
|
|
|
detailfieldids.set(indx, detailfieldid);
|
|
|
detailfieldvalues.set(indx, detailvalues);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (detailfields.size() > 0) {
|
|
|
DetailTableFields.add(detailfields);
|
|
|
DetailTableFieldValues.add(detailfieldvalues);
|
|
|
DetailTableFieldNames.add(detialfieldnames);
|
|
|
DetailTableFieldIds.add(detailfieldids);
|
|
|
DetailFieldIsViews.add(detailisviews);
|
|
|
DetailTableIds.add(detailids);
|
|
|
DetailUrlList.add(detailurls);
|
|
|
DetailUrlLinkList.add(detailurllinks);
|
|
|
DetailFieldDBTypes.add(detailfieldtypes);
|
|
|
DetailDBFieldNames.add(detaildbfnames);
|
|
|
DetailTableChildFields.add(detailchildfieldids);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//单据
|
|
|
if (isbill == 1) {
|
|
|
String detailtable = "";
|
|
|
String maintable = "";
|
|
|
String keyfield = "";
|
|
|
String tempdetailtable = "";
|
|
|
rs.executeSql(" select tablename,detailkeyfield,detailtablename from Workflow_bill where id=" + formid);
|
|
|
if (rs.next()) {
|
|
|
maintable = rs.getString("tablename");
|
|
|
keyfield = rs.getString("detailkeyfield");
|
|
|
tempdetailtable = rs.getString("detailtablename");
|
|
|
if (keyfield == null || keyfield.trim().equals("")) {
|
|
|
keyfield = "mainid";
|
|
|
}
|
|
|
}
|
|
|
if (maintable != null && !maintable.trim().equals("")) {
|
|
|
ArrayList detailtablelist = new ArrayList();
|
|
|
String detailtables = "";
|
|
|
rs1.executeSql("select detailtable from workflow_billfield where billid=" + formid + " and viewtype=1 group by detailtable");
|
|
|
while (rs1.next()) {
|
|
|
String detailtemp = rs1.getString("detailtable");
|
|
|
if (detailtables.equals("")) {
|
|
|
if (detailtemp == null || detailtemp.trim().equals("")) {
|
|
|
detailtables = "null,''";
|
|
|
} else {
|
|
|
detailtables = "'" + detailtemp + "'";
|
|
|
}
|
|
|
} else {
|
|
|
if (detailtemp == null || detailtemp.trim().equals("")) {
|
|
|
detailtables += ",null,''";
|
|
|
} else {
|
|
|
detailtables += ",'" + detailtemp + "'";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (detailtables.length() > 0) {
|
|
|
String emptySqlStr = buildEmptyDetail ? "" : " and tablename in(" + detailtables + ")";
|
|
|
rs1.executeSql("select tablename from WORKFLOW_BILLDETAILTABLE where billid=" + formid + " "+emptySqlStr+" order by orderid");
|
|
|
while (rs1.next()) {
|
|
|
detailtablelist.add(rs1.getString("tablename"));
|
|
|
}
|
|
|
}
|
|
|
if (detailtablelist.size() < 1 && tempdetailtable.length() > 0) {
|
|
|
detailtablelist.add("");
|
|
|
}
|
|
|
for (int deno = 0; deno < detailtablelist.size(); deno++) {
|
|
|
String fieldnames = "";
|
|
|
detailtable = (String) detailtablelist.get(deno);
|
|
|
if (detailtable == null || detailtable.trim().equals("")) {
|
|
|
sql = "select id,labelname,fieldhtmltype,type,fieldname,fielddbtype,childfieldid from workflow_billfield,HtmlLabelInfo where fieldlabel=indexid and languageid=" + languageid + " and billid=" + formid + " and (detailtable is null or detailtable='" + detailtable + "') and viewtype=1 order by dsporder";
|
|
|
detailtable = tempdetailtable;
|
|
|
} else {
|
|
|
sql = "select id,labelname,fieldhtmltype,type,fieldname,fielddbtype,childfieldid from workflow_billfield,HtmlLabelInfo where fieldlabel=indexid and languageid=" + languageid + " and billid=" + formid + " and detailtable='" + detailtable + "' and viewtype=1 order by dsporder";
|
|
|
}
|
|
|
ArrayList detailfieldtypes = new ArrayList();
|
|
|
ArrayList detaildbfnames = new ArrayList();
|
|
|
ArrayList detailfields = new ArrayList();
|
|
|
ArrayList detialfieldnames = new ArrayList();
|
|
|
ArrayList detailurls = new ArrayList();
|
|
|
ArrayList detailurllinks = new ArrayList();
|
|
|
ArrayList detailfieldvalues = new ArrayList();
|
|
|
ArrayList detailisviews = new ArrayList();
|
|
|
ArrayList detailfieldids = new ArrayList();
|
|
|
ArrayList detailids = new ArrayList();
|
|
|
ArrayList detailchildfieldids = new ArrayList();
|
|
|
/* if (formid == 201) {
|
|
|
sql = "select id,labelname,fieldhtmltype,type,fieldname,fielddbtype,childfieldid from workflow_billfield ,HtmlLabelInfo where fieldlabel=indexid and languageid=" + languageid + " and billid=" + formid + " and viewtype=1 order by dsporder";
|
|
|
}*/
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
id = rs.getString("id");
|
|
|
type = rs.getString("type");
|
|
|
htmltype = rs.getInt("fieldhtmltype");
|
|
|
String fieldname = rs.getString("fieldname");
|
|
|
fielddbtype = rs.getString("fielddbtype");
|
|
|
childfieldid = Util.getIntValue(rs.getString("childfieldid"), 0);
|
|
|
sql = "select isview from workflow_modeview where nodeid=" + currentnodeid + " and formid=" + formid + " and isbill=1 and fieldid=" + id;
|
|
|
rs1.execute(sql);
|
|
|
if (rs1.next() && rs1.getInt("isview") == 1) {
|
|
|
isview = "1";
|
|
|
} else {
|
|
|
isview = "";
|
|
|
}
|
|
|
if (fieldnames.equals("")) {
|
|
|
fieldnames = "b." + fieldname;
|
|
|
} else {
|
|
|
fieldnames += ",b." + fieldname;
|
|
|
}
|
|
|
if (htmltype == 3) {
|
|
|
if (type.equals("161") || type.equals("162") || type.equals("224") || type.equals("225"))
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype);
|
|
|
else if (type.equals("256") || type.equals("257"))
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype + "_" + type);
|
|
|
else
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type));
|
|
|
detailurllinks.add(urlcominfo.getLinkurl(type));
|
|
|
} else {
|
|
|
detailurls.add("");
|
|
|
detailurllinks.add("");
|
|
|
}
|
|
|
if (htmltype == 3 && (type.equals("224") || type.equals("225"))) { // sap自定义浏览按钮
|
|
|
fielddbtype = "varchar2(1000)";
|
|
|
if (type.equals("225")) {
|
|
|
fielddbtype = "varchar2(4000)";
|
|
|
}
|
|
|
}
|
|
|
detailfieldids.add(new ArrayList());
|
|
|
detailfieldvalues.add(new ArrayList());
|
|
|
detailfieldtypes.add(fielddbtype);
|
|
|
detaildbfnames.add(fieldname);
|
|
|
detailisviews.add(isview);
|
|
|
detailfields.add("field" + id + "_0_" + type + "_" + htmltype);
|
|
|
detialfieldnames.add(rs.getString("labelname"));
|
|
|
detailchildfieldids.add("" + childfieldid);
|
|
|
}
|
|
|
if (Requestid > 0) {
|
|
|
String detailid = "";
|
|
|
if (formid == 156 || formid == 157 || formid == 158 || formid == 159) {
|
|
|
detailid = "dsporder";
|
|
|
sql = "select b.dsporder";
|
|
|
if (!fieldnames.equals("")) sql += "," + fieldnames;
|
|
|
sql += " from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid + " order by b.dsporder";
|
|
|
} else if (formid == 7 || formid == 14 || formid == 18 || formid == 19 || formid == 201) {//费用报销单。 资产调拨单据
|
|
|
detailid = "id";
|
|
|
sql = "select b.* from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid + " order by b.id";
|
|
|
/*if (formid == 201) {
|
|
|
sql = "select b.* from bill_Discard_Detail b,bill_Discard a where a.requestid=b.detailrequestid and a.requestid=" + Requestid + " order by b.id ";
|
|
|
}*/
|
|
|
} else if ((maintable.indexOf("formtable_main_") == 0 || maintable.indexOf("uf_") == 0)
|
|
|
&& (detailtable.indexOf("formtable_main_") == 0 || detailtable.indexOf("uf_") == 0)) {//新表单,formid<0,所以与上面的不会冲突。
|
|
|
detailid = "id";
|
|
|
sql = "select b.id";
|
|
|
if (!fieldnames.equals("")) sql += "," + fieldnames;
|
|
|
sql += " from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid + " order by b.id";
|
|
|
} else if (formid < 0) { //数据中心模块创建的明细报表
|
|
|
detailid = "inputid";
|
|
|
sql = "select b.inputid";
|
|
|
if (!fieldnames.equals("")) sql += "," + fieldnames;
|
|
|
sql += " from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid + " order by b.inputid";
|
|
|
} else {
|
|
|
detailid = "id";
|
|
|
sql = "select b.* from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid;
|
|
|
}
|
|
|
rs1.executeSql(sql);
|
|
|
String[] colnames = rs1.getColumnName();
|
|
|
for (int k = 0; k < colnames.length; k++) {
|
|
|
if (detailid.equalsIgnoreCase(colnames[k])) {
|
|
|
rs1.beforFirst();
|
|
|
while (rs1.next()) {
|
|
|
fieldvalue = rs1.getString(colnames[k]);
|
|
|
detailids.add(fieldvalue);
|
|
|
}
|
|
|
} else {
|
|
|
//int indx = detaildbfnames.indexOf(colnames[k]);
|
|
|
int indx = Util.getListIndex(detaildbfnames, colnames[k]);
|
|
|
if (indx > -1) {
|
|
|
ArrayList detailvalues = new ArrayList();
|
|
|
ArrayList detailfieldid = new ArrayList();
|
|
|
String detailfield = (String) detailfields.get(indx);
|
|
|
rs1.beforFirst();
|
|
|
int i = 0;
|
|
|
while (rs1.next()) {
|
|
|
fieldvalue = rs1.getString(colnames[k]);
|
|
|
detailvalues.add(fieldvalue);
|
|
|
detailfieldid.add(Util.StringReplaceOnce(detailfield, "_0_", "_" + i + "_"));
|
|
|
i++;
|
|
|
}
|
|
|
detailfieldids.set(indx, detailfieldid);
|
|
|
detailfieldvalues.set(indx, detailvalues);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (detailfields.size() > 0 || buildEmptyDetail) {
|
|
|
DetailTableFields.add(detailfields);
|
|
|
DetailTableFieldValues.add(detailfieldvalues);
|
|
|
DetailTableFieldNames.add(detialfieldnames);
|
|
|
DetailTableFieldIds.add(detailfieldids);
|
|
|
DetailFieldIsViews.add(detailisviews);
|
|
|
DetailTableIds.add(detailids);
|
|
|
DetailUrlList.add(detailurls);
|
|
|
DetailUrlLinkList.add(detailurllinks);
|
|
|
DetailFieldDBTypes.add(detailfieldtypes);
|
|
|
DetailDBFieldNames.add(detaildbfnames);
|
|
|
DetailTableNames.add(detailtable);
|
|
|
DetailTableKeys.add(keyfield);
|
|
|
DetailTableChildFields.add(detailchildfieldids);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 取得明细表的字段信息
|
|
|
*
|
|
|
* @param formid 表单/单据ID
|
|
|
* @param isbill 是否单据
|
|
|
* @param languageid 显示语言
|
|
|
*/
|
|
|
public void GetDetailTblFields(int formid, int isbill, int languageid){
|
|
|
this.GetDetailTblFields(formid, isbill, languageid, true, false);
|
|
|
}
|
|
|
public void GetDetailTblFields(int formid, int isbill, int languageid, boolean isAutoDecrypt, boolean isReturnDecryptData) {
|
|
|
RecordSet rs1 = new RecordSet();
|
|
|
RecordSet rs2 = new RecordSet();
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String id = "";
|
|
|
String type = "";
|
|
|
int htmltype = 1;
|
|
|
String fieldvalue = "";
|
|
|
String fielddbtype = "";
|
|
|
String sql = "";
|
|
|
//表单
|
|
|
if (isbill == 0) {
|
|
|
rs2.execute("select distinct groupId from workflow_formfield where formid=" + formid + " and isdetail='1' order by groupId");
|
|
|
while (rs2.next()) {
|
|
|
ArrayList detaildbfnames = new ArrayList();
|
|
|
ArrayList detailfields = new ArrayList();
|
|
|
ArrayList detailurls = new ArrayList();
|
|
|
ArrayList detailurllinks = new ArrayList();
|
|
|
ArrayList detailids = new ArrayList();
|
|
|
List tmpDetailValues = new ArrayList();
|
|
|
List<String> lstFieldIds = new ArrayList<String>();
|
|
|
rs.executeSql("select id from Workflow_formdetail where Requestid=" + Requestid + " and groupId=" + rs2.getInt(1) + " order by id");
|
|
|
while (rs.next()) {
|
|
|
detailids.add(rs.getString("id"));
|
|
|
}
|
|
|
String fieldnames = "";
|
|
|
rs.executeSql("select b.id,b.fieldhtmltype,c.fieldlable,b.type,b.fieldname,b.fielddbtype,b.childfieldid from workflow_formfield a,workflow_formdictdetail b,workflow_fieldlable c where a.formid=c.formid and a.fieldid=c.fieldid and c.langurageid=" + languageid + " and a.formid=" + formid + " and a.groupId=" + rs2.getInt(1) + " and a.fieldid=b.id and a.isdetail='1' order by a.fieldorder");
|
|
|
while (rs.next()) {
|
|
|
id = rs.getString("id");
|
|
|
type = rs.getString("type");
|
|
|
htmltype = rs.getInt("fieldhtmltype");
|
|
|
String fieldname = rs.getString("fieldname");
|
|
|
fielddbtype = rs.getString("fielddbtype");
|
|
|
if (fieldnames.equals("")) {
|
|
|
fieldnames = fieldname;
|
|
|
} else {
|
|
|
fieldnames += "," + fieldname;
|
|
|
}
|
|
|
if (htmltype == 3) {
|
|
|
if (type.equals("161") || type.equals("162") || type.equals("224") || type.equals("225"))
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype);
|
|
|
else if (type.equals("256") || type.equals("257"))
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype + "_" + type);
|
|
|
else
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type));
|
|
|
detailurllinks.add(urlcominfo.getLinkurl(type));
|
|
|
} else {
|
|
|
detailurls.add("");
|
|
|
detailurllinks.add("");
|
|
|
}
|
|
|
if (htmltype == 3 && (type.equals("224") || type.equals("225"))) { // sap自定义浏览按钮
|
|
|
fielddbtype = "varchar2(1000)";
|
|
|
if (type.equals("225")) {
|
|
|
fielddbtype = "varchar2(4000)";
|
|
|
}
|
|
|
}
|
|
|
detaildbfnames.add(fieldname);
|
|
|
detailfields.add("field" + id + "_0_" + type + "_" + htmltype);
|
|
|
lstFieldIds.add(id);
|
|
|
}
|
|
|
if (Requestid > 0) {
|
|
|
sql = "select " + fieldnames + " from Workflow_formdetail where Requestid=" + Requestid + " and groupId=" + rs2.getInt(1) + " order by id";
|
|
|
rs1.executeSql(sql);
|
|
|
String[] colNames = rs1.getColumnName();
|
|
|
while (rs1.next()) {
|
|
|
Map<String, String> mapDetailField = new HashMap<String, String>();
|
|
|
for (String colName : colNames) {
|
|
|
int indx = Util.getListIndex(detaildbfnames, colName);
|
|
|
if (indx > -1) {
|
|
|
fieldvalue = Util.null2String(rs1.getString(colName));
|
|
|
String fieldID = lstFieldIds.get(indx);
|
|
|
mapDetailField.put(fieldID, fieldvalue);
|
|
|
}
|
|
|
}
|
|
|
tmpDetailValues.add(mapDetailField);
|
|
|
}
|
|
|
}
|
|
|
if (detailfields.size() > 0) {
|
|
|
DetailTableFields.add(detailfields);
|
|
|
DetailTableIds.add(detailids);
|
|
|
DetailUrlList.add(detailurls);
|
|
|
DetailUrlLinkList.add(detailurllinks);
|
|
|
DetailDBFieldNames.add(detaildbfnames);
|
|
|
lstDetailTblFields.add(tmpDetailValues);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//单据
|
|
|
if (isbill == 1) {
|
|
|
String detailtable = "";
|
|
|
String maintable = "";
|
|
|
String keyfield = "";
|
|
|
String tempdetailtable = "";
|
|
|
rs.executeSql(" select tablename,detailkeyfield,detailtablename from Workflow_bill where id=" + formid);
|
|
|
if (rs.next()) {
|
|
|
maintable = rs.getString("tablename");
|
|
|
keyfield = rs.getString("detailkeyfield");
|
|
|
tempdetailtable = rs.getString("detailtablename");
|
|
|
if (keyfield == null || keyfield.trim().equals("")) {
|
|
|
keyfield = "mainid";
|
|
|
}
|
|
|
}
|
|
|
if (maintable != null && !maintable.trim().equals("")) {
|
|
|
ArrayList detailtablelist = new ArrayList();
|
|
|
String detailtables = "";
|
|
|
rs1.executeSql("select detailtable from workflow_billfield where billid=" + formid + " and viewtype=1 group by detailtable");
|
|
|
while (rs1.next()) {
|
|
|
String detailtemp = rs1.getString("detailtable");
|
|
|
if (detailtables.equals("")) {
|
|
|
if (detailtemp == null || detailtemp.trim().equals("")) {
|
|
|
detailtables = "null,''";
|
|
|
} else {
|
|
|
detailtables = "'" + detailtemp + "'";
|
|
|
}
|
|
|
} else {
|
|
|
if (detailtemp == null || detailtemp.trim().equals("")) {
|
|
|
detailtables += ",null,''";
|
|
|
} else {
|
|
|
detailtables += ",'" + detailtemp + "'";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (detailtables.length() > 0) {
|
|
|
rs1.executeSql("select tablename from WORKFLOW_BILLDETAILTABLE where billid=" + formid + " and tablename in(" + detailtables + ") order by orderid");
|
|
|
while (rs1.next()) {
|
|
|
detailtablelist.add(rs1.getString("tablename"));
|
|
|
}
|
|
|
}
|
|
|
if (detailtablelist.size() < 1 && tempdetailtable.length() > 0) {
|
|
|
detailtablelist.add("");
|
|
|
}
|
|
|
for (int deno = 0; deno < detailtablelist.size(); deno++) {
|
|
|
String fieldnames = "";
|
|
|
detailtable = (String) detailtablelist.get(deno);
|
|
|
if (detailtable == null || detailtable.trim().equals("")) {
|
|
|
sql = "select id,labelname,fieldhtmltype,type,fieldname,fielddbtype,childfieldid from workflow_billfield,HtmlLabelInfo where fieldlabel=indexid and languageid=" + languageid + " and billid=" + formid + " and (detailtable is null or detailtable='" + detailtable + "') and viewtype=1 order by dsporder";
|
|
|
detailtable = tempdetailtable;
|
|
|
} else {
|
|
|
sql = "select id,labelname,fieldhtmltype,type,fieldname,fielddbtype,childfieldid from workflow_billfield,HtmlLabelInfo where fieldlabel=indexid and languageid=" + languageid + " and billid=" + formid + " and detailtable='" + detailtable + "' and viewtype=1 order by dsporder";
|
|
|
}
|
|
|
ArrayList detaildbfnames = new ArrayList();
|
|
|
ArrayList detailfields = new ArrayList();
|
|
|
ArrayList detailurls = new ArrayList();
|
|
|
ArrayList detailurllinks = new ArrayList();
|
|
|
ArrayList detailids = new ArrayList();
|
|
|
List tmpDetailValues = new ArrayList();
|
|
|
List<String> lstFieldIds = new ArrayList<String>();
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
id = rs.getString("id");
|
|
|
type = rs.getString("type");
|
|
|
htmltype = rs.getInt("fieldhtmltype");
|
|
|
String fieldname = rs.getString("fieldname");
|
|
|
fielddbtype = rs.getString("fielddbtype");
|
|
|
if (fieldnames.equals("")) {
|
|
|
fieldnames = "b." + fieldname;
|
|
|
} else {
|
|
|
fieldnames += ",b." + fieldname;
|
|
|
}
|
|
|
if (htmltype == 3) {
|
|
|
if (type.equals("161") || type.equals("162") || type.equals("224") || type.equals("225"))
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype);
|
|
|
else if (type.equals("256") || type.equals("257"))
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype + "_" + type);
|
|
|
else
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type));
|
|
|
detailurllinks.add(urlcominfo.getLinkurl(type));
|
|
|
} else {
|
|
|
detailurls.add("");
|
|
|
detailurllinks.add("");
|
|
|
}
|
|
|
if (htmltype == 3 && (type.equals("224") || type.equals("225"))) { // sap自定义浏览按钮
|
|
|
fielddbtype = "varchar2(1000)";
|
|
|
if (type.equals("225")) {
|
|
|
fielddbtype = "varchar2(4000)";
|
|
|
}
|
|
|
}
|
|
|
detaildbfnames.add(fieldname);
|
|
|
detailfields.add("field" + id + "_0_" + type + "_" + htmltype);
|
|
|
lstFieldIds.add(id);
|
|
|
}
|
|
|
if (Requestid > 0) {
|
|
|
String detailid = "";
|
|
|
if (formid == 156 || formid == 157 || formid == 158 || formid == 159) {
|
|
|
detailid = "dsporder";
|
|
|
sql = "select b.dsporder";
|
|
|
if (!fieldnames.equals("")) sql += "," + fieldnames;
|
|
|
sql += " from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid + " order by b.dsporder";
|
|
|
} else if (formid == 7 || formid == 14 || formid == 18) {//费用报销单。 资产调拨单据
|
|
|
detailid = "id";
|
|
|
sql = "select b.* from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid + " order by b.id";
|
|
|
} else if ((maintable.indexOf("formtable_main_") == 0 || maintable.indexOf("uf_") == 0)
|
|
|
&& (detailtable.indexOf("formtable_main_") == 0 || detailtable.indexOf("uf_") == 0)) {//新表单,formid<0,所以与上面的不会冲突。
|
|
|
detailid = "id";
|
|
|
sql = "select b.id";
|
|
|
if (!fieldnames.equals("")) sql += "," + fieldnames;
|
|
|
sql += " from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid + " order by b.id";
|
|
|
} else if (formid < 0) { //数据中心模块创建的明细报表
|
|
|
detailid = "inputid";
|
|
|
sql = "select b.inputid";
|
|
|
if (!fieldnames.equals("")) sql += "," + fieldnames;
|
|
|
sql += " from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid + " order by b.inputid";
|
|
|
} else {
|
|
|
detailid = "id";
|
|
|
sql = "select b.* from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid;
|
|
|
}
|
|
|
rs1.executeSql(sql);
|
|
|
|
|
|
String[] colNames = rs1.getColumnName();
|
|
|
while (rs1.next()) {
|
|
|
Map<String, String> mapDetailField = new HashMap<String, String>();
|
|
|
for (String colName : colNames) {
|
|
|
if (detailid.equalsIgnoreCase(colName)) {
|
|
|
fieldvalue = rs1.getString(colName);
|
|
|
detailids.add(fieldvalue);
|
|
|
} else {
|
|
|
int indx = Util.getListIndex(detaildbfnames, colName);
|
|
|
if (indx > -1) {
|
|
|
String fieldID = lstFieldIds.get(indx);
|
|
|
fieldvalue = Util.null2String(rs1.getString(detailtable, colName, isAutoDecrypt, isReturnDecryptData));
|
|
|
mapDetailField.put(fieldID, fieldvalue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
tmpDetailValues.add(mapDetailField);
|
|
|
}
|
|
|
}
|
|
|
if (detailfields.size() > 0) {
|
|
|
DetailTableFields.add(detailfields);
|
|
|
DetailTableIds.add(detailids);
|
|
|
DetailUrlList.add(detailurls);
|
|
|
DetailUrlLinkList.add(detailurllinks);
|
|
|
DetailDBFieldNames.add(detaildbfnames);
|
|
|
DetailTableNames.add(detailtable);
|
|
|
DetailTableKeys.add(keyfield);
|
|
|
lstDetailTblFields.add(tmpDetailValues);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 支持排序
|
|
|
* @param formid
|
|
|
* @param isbill
|
|
|
* @param languageid
|
|
|
* @param isAutoDecrypt
|
|
|
* @param isReturnDecryptData
|
|
|
*/
|
|
|
public void GetDetailTblFieldsWithSort(int formid, int isbill, int languageid, boolean isAutoDecrypt, boolean isReturnDecryptData,String workflowId,String nodeId) {
|
|
|
|
|
|
DetailOrderManager detailOrderManager = new DetailOrderManager();
|
|
|
|
|
|
|
|
|
RecordSet rs1 = new RecordSet();
|
|
|
RecordSet rs2 = new RecordSet();
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String id = "";
|
|
|
String type = "";
|
|
|
int htmltype = 1;
|
|
|
String fieldvalue = "";
|
|
|
String fielddbtype = "";
|
|
|
String sql = "";
|
|
|
//表单
|
|
|
if (isbill == 0) {
|
|
|
int groupId =1;
|
|
|
rs2.execute("select distinct groupId from workflow_formfield where formid=" + formid + " and isdetail='1' order by groupId");
|
|
|
while (rs2.next()) {
|
|
|
String orderSql = detailOrderManager.getOrderSql(workflowId, nodeId, formid+"", isbill+"", String.valueOf(languageid), groupId + "", " ", "b","id");
|
|
|
ArrayList detaildbfnames = new ArrayList();
|
|
|
ArrayList detailfields = new ArrayList();
|
|
|
ArrayList detailurls = new ArrayList();
|
|
|
ArrayList detailurllinks = new ArrayList();
|
|
|
ArrayList detailids = new ArrayList();
|
|
|
List tmpDetailValues = new ArrayList();
|
|
|
List<String> lstFieldIds = new ArrayList<String>();
|
|
|
rs.executeSql("select b.id from Workflow_formdetail b where b.Requestid=" + Requestid + " and b.groupId=" + rs2.getInt(1) + " order by " + orderSql);
|
|
|
while (rs.next()) {
|
|
|
detailids.add(rs.getString("id"));
|
|
|
}
|
|
|
String fieldnames = "";
|
|
|
rs.executeSql("select b.id,b.fieldhtmltype,c.fieldlable,b.type,b.fieldname,b.fielddbtype,b.childfieldid from workflow_formfield a,workflow_formdictdetail b,workflow_fieldlable c where a.formid=c.formid and a.fieldid=c.fieldid and c.langurageid=" + languageid + " and a.formid=" + formid + " and a.groupId=" + rs2.getInt(1) + " and a.fieldid=b.id and a.isdetail='1' order by a.fieldorder");
|
|
|
while (rs.next()) {
|
|
|
id = rs.getString("id");
|
|
|
type = rs.getString("type");
|
|
|
htmltype = rs.getInt("fieldhtmltype");
|
|
|
String fieldname = rs.getString("fieldname");
|
|
|
fielddbtype = rs.getString("fielddbtype");
|
|
|
if (fieldnames.equals("")) {
|
|
|
fieldnames = "b." + fieldname;
|
|
|
} else {
|
|
|
fieldnames += "," + "b." + fieldname;
|
|
|
}
|
|
|
if (htmltype == 3) {
|
|
|
if (type.equals("161") || type.equals("162") || type.equals("224") || type.equals("225"))
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype);
|
|
|
else if (type.equals("256") || type.equals("257"))
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype + "_" + type);
|
|
|
else
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type));
|
|
|
detailurllinks.add(urlcominfo.getLinkurl(type));
|
|
|
} else {
|
|
|
detailurls.add("");
|
|
|
detailurllinks.add("");
|
|
|
}
|
|
|
if (htmltype == 3 && (type.equals("224") || type.equals("225"))) { // sap自定义浏览按钮
|
|
|
fielddbtype = "varchar2(1000)";
|
|
|
if (type.equals("225")) {
|
|
|
fielddbtype = "varchar2(4000)";
|
|
|
}
|
|
|
}
|
|
|
detaildbfnames.add(fieldname);
|
|
|
detailfields.add("field" + id + "_0_" + type + "_" + htmltype);
|
|
|
lstFieldIds.add(id);
|
|
|
}
|
|
|
if (Requestid > 0) {
|
|
|
sql = "select " + fieldnames + " from Workflow_formdetail b where b.Requestid=" + Requestid + " and b.groupId=" + rs2.getInt(1) + " order by " + orderSql;
|
|
|
rs1.executeSql(sql);
|
|
|
String[] colNames = rs1.getColumnName();
|
|
|
while (rs1.next()) {
|
|
|
Map<String, String> mapDetailField = new HashMap<String, String>();
|
|
|
for (String colName : colNames) {
|
|
|
int indx = Util.getListIndex(detaildbfnames, colName);
|
|
|
if (indx > -1) {
|
|
|
fieldvalue = Util.null2String(rs1.getString(colName));
|
|
|
String fieldID = lstFieldIds.get(indx);
|
|
|
mapDetailField.put(fieldID, fieldvalue);
|
|
|
}
|
|
|
}
|
|
|
tmpDetailValues.add(mapDetailField);
|
|
|
}
|
|
|
}
|
|
|
if (detailfields.size() > 0) {
|
|
|
DetailTableFields.add(detailfields);
|
|
|
DetailTableIds.add(detailids);
|
|
|
DetailUrlList.add(detailurls);
|
|
|
DetailUrlLinkList.add(detailurllinks);
|
|
|
DetailDBFieldNames.add(detaildbfnames);
|
|
|
lstDetailTblFields.add(tmpDetailValues);
|
|
|
}
|
|
|
groupId ++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//单据
|
|
|
if (isbill == 1) {
|
|
|
String detailtable = "";
|
|
|
String maintable = "";
|
|
|
String keyfield = "";
|
|
|
String tempdetailtable = "";
|
|
|
rs.executeSql(" select tablename,detailkeyfield,detailtablename from Workflow_bill where id=" + formid);
|
|
|
if (rs.next()) {
|
|
|
maintable = rs.getString("tablename");
|
|
|
keyfield = rs.getString("detailkeyfield");
|
|
|
tempdetailtable = rs.getString("detailtablename");
|
|
|
if (keyfield == null || keyfield.trim().equals("")) {
|
|
|
keyfield = "mainid";
|
|
|
}
|
|
|
}
|
|
|
if (maintable != null && !maintable.trim().equals("")) {
|
|
|
ArrayList detailtablelist = new ArrayList();
|
|
|
String detailtables = "";
|
|
|
rs1.executeSql("select detailtable from workflow_billfield where billid=" + formid + " and viewtype=1 group by detailtable");
|
|
|
while (rs1.next()) {
|
|
|
String detailtemp = rs1.getString("detailtable");
|
|
|
if (detailtables.equals("")) {
|
|
|
if (detailtemp == null || detailtemp.trim().equals("")) {
|
|
|
detailtables = "null,''";
|
|
|
} else {
|
|
|
detailtables = "'" + detailtemp + "'";
|
|
|
}
|
|
|
} else {
|
|
|
if (detailtemp == null || detailtemp.trim().equals("")) {
|
|
|
detailtables += ",null,''";
|
|
|
} else {
|
|
|
detailtables += ",'" + detailtemp + "'";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (detailtables.length() > 0) {
|
|
|
rs1.executeSql("select tablename from WORKFLOW_BILLDETAILTABLE where billid=" + formid + " and tablename in(" + detailtables + ") order by orderid");
|
|
|
while (rs1.next()) {
|
|
|
detailtablelist.add(rs1.getString("tablename"));
|
|
|
}
|
|
|
}
|
|
|
if (detailtablelist.size() < 1 && tempdetailtable.length() > 0) {
|
|
|
detailtablelist.add("");
|
|
|
}
|
|
|
int groupId = 1;
|
|
|
for (int deno = 0; deno < detailtablelist.size(); deno++) {
|
|
|
|
|
|
String fieldnames = "";
|
|
|
detailtable = (String) detailtablelist.get(deno);
|
|
|
if (detailtable == null || detailtable.trim().equals("")) {
|
|
|
sql = "select id,labelname,fieldhtmltype,type,fieldname,fielddbtype,childfieldid from workflow_billfield,HtmlLabelInfo where fieldlabel=indexid and languageid=" + languageid + " and billid=" + formid + " and (detailtable is null or detailtable='" + detailtable + "') and viewtype=1 order by dsporder";
|
|
|
detailtable = tempdetailtable;
|
|
|
} else {
|
|
|
sql = "select id,labelname,fieldhtmltype,type,fieldname,fielddbtype,childfieldid from workflow_billfield,HtmlLabelInfo where fieldlabel=indexid and languageid=" + languageid + " and billid=" + formid + " and detailtable='" + detailtable + "' and viewtype=1 order by dsporder";
|
|
|
}
|
|
|
String orderSql = detailOrderManager.getOrderSql(workflowId, nodeId, formid+"", isbill+"", String.valueOf(languageid), groupId + "", detailtable, "b","id");
|
|
|
ArrayList detaildbfnames = new ArrayList();
|
|
|
ArrayList detailfields = new ArrayList();
|
|
|
ArrayList detailurls = new ArrayList();
|
|
|
ArrayList detailurllinks = new ArrayList();
|
|
|
ArrayList detailids = new ArrayList();
|
|
|
List tmpDetailValues = new ArrayList();
|
|
|
List<String> lstFieldIds = new ArrayList<String>();
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
id = rs.getString("id");
|
|
|
type = rs.getString("type");
|
|
|
htmltype = rs.getInt("fieldhtmltype");
|
|
|
String fieldname = rs.getString("fieldname");
|
|
|
fielddbtype = rs.getString("fielddbtype");
|
|
|
if (fieldnames.equals("")) {
|
|
|
fieldnames = "b." + fieldname;
|
|
|
} else {
|
|
|
fieldnames += ",b." + fieldname;
|
|
|
}
|
|
|
if (htmltype == 3) {
|
|
|
if (type.equals("161") || type.equals("162") || type.equals("224") || type.equals("225"))
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype);
|
|
|
else if (type.equals("256") || type.equals("257"))
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type) + "?type=" + fielddbtype + "_" + type);
|
|
|
else
|
|
|
detailurls.add(urlcominfo.getBrowserurl(type));
|
|
|
detailurllinks.add(urlcominfo.getLinkurl(type));
|
|
|
} else {
|
|
|
detailurls.add("");
|
|
|
detailurllinks.add("");
|
|
|
}
|
|
|
if (htmltype == 3 && (type.equals("224") || type.equals("225"))) { // sap自定义浏览按钮
|
|
|
fielddbtype = "varchar2(1000)";
|
|
|
if (type.equals("225")) {
|
|
|
fielddbtype = "varchar2(4000)";
|
|
|
}
|
|
|
}
|
|
|
detaildbfnames.add(fieldname);
|
|
|
detailfields.add("field" + id + "_0_" + type + "_" + htmltype);
|
|
|
lstFieldIds.add(id);
|
|
|
}
|
|
|
if (Requestid > 0) {
|
|
|
String detailid = "";
|
|
|
if (formid == 156 || formid == 157 || formid == 158 || formid == 159) {
|
|
|
detailid = "dsporder";
|
|
|
sql = "select b.dsporder";
|
|
|
if (!fieldnames.equals("")) sql += "," + fieldnames;
|
|
|
sql += " from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid + " order by b.dsporder";
|
|
|
} else if (formid == 7 || formid == 14 || formid == 18) {//费用报销单。 资产调拨单据
|
|
|
detailid = "id";
|
|
|
sql = "select b.* from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid + " order by b.id";
|
|
|
} else if ((maintable.indexOf("formtable_main_") == 0 || maintable.indexOf("uf_") == 0)
|
|
|
&& (detailtable.indexOf("formtable_main_") == 0 || detailtable.indexOf("uf_") == 0)) {//新表单,formid<0,所以与上面的不会冲突。
|
|
|
detailid = "id";
|
|
|
sql = "select b.id";
|
|
|
if (!fieldnames.equals("")) sql += "," + fieldnames;
|
|
|
sql += " from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid + " order by " + orderSql;
|
|
|
} else if (formid < 0) { //数据中心模块创建的明细报表
|
|
|
detailid = "inputid";
|
|
|
sql = "select b.inputid";
|
|
|
if (!fieldnames.equals("")) sql += "," + fieldnames;
|
|
|
sql += " from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid + " order by b.inputid";
|
|
|
} else {
|
|
|
detailid = "id";
|
|
|
sql = "select b.* from " + maintable + " a," + detailtable + " b where a.id=b." + keyfield + " and a.requestid = " + Requestid;
|
|
|
}
|
|
|
rs1.executeSql(sql);
|
|
|
|
|
|
String[] colNames = rs1.getColumnName();
|
|
|
while (rs1.next()) {
|
|
|
Map<String, String> mapDetailField = new HashMap<String, String>();
|
|
|
for (String colName : colNames) {
|
|
|
if (detailid.equalsIgnoreCase(colName)) {
|
|
|
fieldvalue = rs1.getString(colName);
|
|
|
detailids.add(fieldvalue);
|
|
|
} else {
|
|
|
int indx = Util.getListIndex(detaildbfnames, colName);
|
|
|
if (indx > -1) {
|
|
|
String fieldID = lstFieldIds.get(indx);
|
|
|
fieldvalue = Util.null2String(rs1.getString(detailtable, colName, isAutoDecrypt, isReturnDecryptData));
|
|
|
mapDetailField.put(fieldID, fieldvalue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
tmpDetailValues.add(mapDetailField);
|
|
|
}
|
|
|
}
|
|
|
if (detailfields.size() > 0) {
|
|
|
DetailTableFields.add(detailfields);
|
|
|
DetailTableIds.add(detailids);
|
|
|
DetailUrlList.add(detailurls);
|
|
|
DetailUrlLinkList.add(detailurllinks);
|
|
|
DetailDBFieldNames.add(detaildbfnames);
|
|
|
DetailTableNames.add(detailtable);
|
|
|
DetailTableKeys.add(keyfield);
|
|
|
lstDetailTblFields.add(tmpDetailValues);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得manager字段的ID
|
|
|
*
|
|
|
* @param formid
|
|
|
* @param isbill
|
|
|
* @return
|
|
|
*/
|
|
|
public int getManagerFieldID(int formid, int isbill) {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
int managerfieldid = -1;
|
|
|
//表单
|
|
|
if (isbill == 0) {
|
|
|
rs.executeSql("select b.id from workflow_formfield a,workflow_formdict b where a.fieldid=b.id and a.isdetail is null and a.formid=" + formid + " and b.fieldname='manager'");
|
|
|
if (rs.next()) {
|
|
|
managerfieldid = Util.getIntValue(rs.getString("id"));
|
|
|
}
|
|
|
}
|
|
|
//单据
|
|
|
if (isbill == 1) {
|
|
|
rs.executeSql("select id from workflow_billfield where billid=" + formid + " and viewtype=0 and fieldname='manager'");
|
|
|
if (rs.next()) {
|
|
|
managerfieldid = Util.getIntValue(rs.getString("id"));
|
|
|
}
|
|
|
}
|
|
|
return managerfieldid;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 取得工作流的节点信息
|
|
|
*
|
|
|
* @param workflowid 工作流ID
|
|
|
*/
|
|
|
public void GetWorkflowNode(int workflowid) {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
if (!"1".equals(iswfshare)) {
|
|
|
rs.executeSql("select nodeid,nodename from workflow_flownode,workflow_nodebase where (workflow_nodebase.IsFreeNode is null or workflow_nodebase.IsFreeNode!='1') and nodeid=id and workflowid=" + workflowid + " order by nodetype,nodeid");
|
|
|
while (rs.next()) {
|
|
|
Nodes.add("wfl" + workflowid + "_" + rs.getString("nodeid"));
|
|
|
NodeNames.add(rs.getString("nodename"));
|
|
|
}
|
|
|
Nodes.add("wfl" + workflowid + "_999999999");
|
|
|
NodeNames.add(""+ SystemEnv.getHtmlLabelName(84441,weaver.general.ThreadVarLanguage.getLang())+"");
|
|
|
} else {
|
|
|
try {
|
|
|
String userids = "";
|
|
|
String viewNodeId = "";
|
|
|
String singleViewLogIds = "";
|
|
|
String tempNodeId = "";
|
|
|
RecordSet rs1 = new RecordSet();
|
|
|
RecordSet rs2 = new RecordSet();
|
|
|
RecordSet rs3 = new RecordSet();
|
|
|
WFShareAuthorization wfShareAuthorization = new WFShareAuthorization();
|
|
|
WFManager wfManager = new WFManager();
|
|
|
|
|
|
userids = wfShareAuthorization.getSignByrstUser(String.valueOf(Requestid), user);
|
|
|
|
|
|
//流程共享的签字意见查看权限与共享人权限一致
|
|
|
if (!"".equals(userids)) {
|
|
|
rs1.executeSql("select workflowid from workflow_requestbase where requestid = " + Requestid);
|
|
|
if (rs1.next()) {
|
|
|
wfManager.setWfid(rs1.getInt("workflowid"));
|
|
|
wfManager.getWfInfo();
|
|
|
}
|
|
|
String issignview = wfManager.getIssignview();
|
|
|
if ("1".equals(issignview)) {
|
|
|
rs2.executeSql("select a.nodeid from workflow_currentoperator a where a.requestid=" + Requestid + " and exists (select 1 from workflow_currentoperator b where b.isremark in ('0','2','4') and b.requestid=" + Requestid + " and a.userid=b.userid) and userid in (" + userids + ") order by receivedate desc ,receivetime desc");
|
|
|
if (rs2.next()) {
|
|
|
viewNodeId = rs2.getString("nodeid");
|
|
|
rs3.executeSql("select viewnodeids from workflow_flownode where workflowid=" + workflowid + " and nodeid=" + viewNodeId);
|
|
|
if (rs3.next()) {
|
|
|
singleViewLogIds = rs3.getString("viewnodeids");
|
|
|
}
|
|
|
if ("-1".equals(singleViewLogIds)) {//全部查看
|
|
|
rs3.executeSql("select nodeid from workflow_flownode where workflowid= " + workflowid + " and exists(select 1 from workflow_nodebase where id=workflow_flownode.nodeid and (requestid is null or requestid=" + Requestid + "))");
|
|
|
while (rs3.next()) {
|
|
|
tempNodeId = rs3.getString("nodeid");
|
|
|
if (!Nodes.contains("wfl" + workflowid + "_" + tempNodeId)) {
|
|
|
Nodes.add("wfl" + workflowid + "_" + tempNodeId);
|
|
|
}
|
|
|
}
|
|
|
} else if (singleViewLogIds == null || "".equals(singleViewLogIds)) {//全部不能查看
|
|
|
|
|
|
} else {//查看部分
|
|
|
String tempidstrs[] = Util.TokenizerString2(singleViewLogIds, ",");
|
|
|
for (int i = 0; i < tempidstrs.length; i++) {
|
|
|
if (!Nodes.contains("wfl" + workflowid + "_" + tempidstrs[i])) {
|
|
|
Nodes.add("wfl" + workflowid + "_" + tempidstrs[i]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
rs2.executeSql("select distinct a.nodeid from workflow_currentoperator a where a.requestid=" + Requestid + " and exists (select 1 from workflow_currentoperator b where b.isremark in ('0','2','4') and b.requestid=" + Requestid + " and a.userid=b.userid) and userid in (" + userids + ") ");
|
|
|
while (rs2.next()) {
|
|
|
viewNodeId = rs2.getString("nodeid");
|
|
|
rs3.executeSql("select viewnodeids from workflow_flownode where workflowid=" + workflowid + " and nodeid=" + viewNodeId);
|
|
|
if (rs3.next()) {
|
|
|
singleViewLogIds = rs3.getString("viewnodeids");
|
|
|
}
|
|
|
|
|
|
if ("-1".equals(singleViewLogIds)) {//全部查看
|
|
|
rs3.executeSql("select nodeid from workflow_flownode where workflowid= " + workflowid + " and exists(select 1 from workflow_nodebase where id=workflow_flownode.nodeid and (requestid is null or requestid=" + Requestid + "))");
|
|
|
while (rs3.next()) {
|
|
|
tempNodeId = rs3.getString("nodeid");
|
|
|
if (!Nodes.contains("wfl" + workflowid + "_" + tempNodeId)) {
|
|
|
Nodes.add("wfl" + workflowid + "_" + tempNodeId);
|
|
|
}
|
|
|
}
|
|
|
} else if (singleViewLogIds == null || "".equals(singleViewLogIds)) {//全部不能查看
|
|
|
|
|
|
} else {//查看部分
|
|
|
String tempidstrs[] = Util.TokenizerString2(singleViewLogIds, ",");
|
|
|
for (int i = 0; i < tempidstrs.length; i++) {
|
|
|
if (!Nodes.contains("wfl" + workflowid + "_" + tempidstrs[i])) {
|
|
|
Nodes.add("wfl" + workflowid + "_" + tempidstrs[i]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
/////////////////////////////////
|
|
|
Nodes.add("wfl" + workflowid + "_999999999");
|
|
|
NodeNames.add(""+ SystemEnv.getHtmlLabelName(84441,weaver.general.ThreadVarLanguage.getLang())+"");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
// TODO Auto-generated catch block
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取自由流程的签字意见
|
|
|
*/
|
|
|
public String GetfreeNodeRemark(int workflowid, int currentnodeid, int ismode,NodeSignInputSetEntity entity) {
|
|
|
if (ismode == 1)
|
|
|
ismode = 0;
|
|
|
//-9999表示自由节点
|
|
|
String str = GetNodeRemarkInner(workflowid, -9999, currentnodeid, ismode,entity);
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
|
|
|
public String GetfreeNodeRemark(int workflowid, int currentnodeid, int ismode){
|
|
|
return GetfreeNodeRemark(workflowid,currentnodeid,ismode,null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到节点的批注,这个是最原始的方法,现有的调用地方都基本调用这个方法,大多是图形化模式的
|
|
|
*
|
|
|
* @param workflowid 工作流
|
|
|
* @param nodeid 节点ID
|
|
|
* @param currentnodeid 流程当前节点
|
|
|
* @return 节点的批注
|
|
|
*/
|
|
|
public String GetNodeRemark(int workflowid, int nodeid, int currentnodeid) {
|
|
|
try {
|
|
|
return GetNodeRemarkInner(workflowid, nodeid, currentnodeid, 0);
|
|
|
} catch (Exception e) {
|
|
|
log.info("Catch a exception.", e);
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到节点的批注,这个是新写的方法,用来Html模式下调用,主要为了适应6.0中把签字意见填写模式改成Html控件的了
|
|
|
*
|
|
|
* @param workflowid 工作流
|
|
|
* @param nodeid 节点ID
|
|
|
* @param currentnodeid 流程当前节点
|
|
|
* @param ismode 流程模式;1,图形化模式;2,Html模式;0,一般模式。但是一般模式好像用不到这个方法
|
|
|
* @return 节点的批注
|
|
|
*/
|
|
|
public String GetNodeRemark(int workflowid, int nodeid, int currentnodeid, int ismode) {
|
|
|
try {
|
|
|
return GetNodeRemarkInner(workflowid, nodeid, currentnodeid, ismode,null);
|
|
|
} catch (Exception e) {
|
|
|
log.info("Catch a exception.", e);
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public String GetNodeRemark(int workflowid, int nodeid, int currentnodeid, int ismode, NodeSignInputSetEntity entity) {
|
|
|
try {
|
|
|
return GetNodeRemarkInner(workflowid, nodeid, currentnodeid, ismode,entity);
|
|
|
} catch (Exception e) {
|
|
|
log.info("Catch a exception.", e);
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private String checkNodemark(String nodemark){
|
|
|
// if(!"1".equals(this.wfinfo.get("isprint")))
|
|
|
// nodemark = RequestFormBiz.manageImgLazyLoad(nodemark);
|
|
|
// 去掉多余分隔符
|
|
|
nodemark = nodemark.replace(String.valueOf(FieldInfo.getNodeSeparator()), "").replace(String.valueOf(Util.getSeparator()), "");
|
|
|
if (nodemark.indexOf("<br>") == 0)
|
|
|
nodemark = nodemark.substring(4, nodemark.length());
|
|
|
if (nodemark.endsWith("<br>"))
|
|
|
nodemark = nodemark.substring(0, nodemark.length() - 4);
|
|
|
return convertChar(nodemark);
|
|
|
}
|
|
|
private String convertChar(String str){
|
|
|
str = str.replaceAll("\\\t", "");
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> GetGroupNodeRemark(int workflowid, int nodeid, int currentnodeid, int ismode, NodeSignInputSetEntity entity) {
|
|
|
try {
|
|
|
GetNodeRemarkInner(workflowid, nodeid, currentnodeid, ismode,entity);
|
|
|
} catch (Exception e) {
|
|
|
log.info("Catch a exception.", e);
|
|
|
}
|
|
|
return nodeMarkContent;
|
|
|
}
|
|
|
|
|
|
public String GetNodeRemarkInner(int workflowid, int nodeid, int currentnodeid, int ismode){
|
|
|
return GetNodeRemarkInner(workflowid,nodeid,currentnodeid,ismode,null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到节点的批注,这个方法具体用来该类中自己使用,为了兼容系统中很多调用原GetNodeRemark(int workflowid,int nodeid,int currentnodeid)的方法,而复写的方法
|
|
|
*
|
|
|
* @param workflowid 作流
|
|
|
* @param nodeid 节点ID
|
|
|
* @param currentnodeid 流程当前节点
|
|
|
* @param ismode 流程模式;1,图形化模式;2,Html模式;0,一般模式。但是一般模式好像用不到这个方法
|
|
|
* 0才是模板模式.......
|
|
|
* @return 节点的批注
|
|
|
*/
|
|
|
public String GetNodeRemarkInner(int workflowid, int nodeid, int currentnodeid, int ismode,NodeSignInputSetEntity entity) {
|
|
|
String NodeRemark = "";
|
|
|
this.layoutNodeid = nodeid;
|
|
|
this.viewNodeidScope = currentnodeid;
|
|
|
nodeMarkContent = new ArrayList<>();
|
|
|
int showimg = Util.getIntValue(getWfsbean().getPropValue("WFSignatureImg", "showimg"), 0);
|
|
|
RecordSet rs1 = new RecordSet();
|
|
|
String orderby = "desc";
|
|
|
WFLinkInfo wfLinkInfo = new WFLinkInfo();
|
|
|
String isshowSrc = wfLinkInfo.getIsshowSrc(workflowid);
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
boolean belongGroup = nodeid == -1 || nodeid == -2 || nodeid == -3;
|
|
|
if (workflowid > 0 && (nodeid > 0 || nodeid == -9999 || nodeid == RequestConstant.ALL_NODE_SIGN_MARK || belongGroup)) {
|
|
|
ArrayList preoperators = new ArrayList();
|
|
|
String username = "";
|
|
|
String departmentname = "";
|
|
|
WFManager wfManager = new WFManager();
|
|
|
wfManager.reset();
|
|
|
wfManager.setWfid(workflowid);
|
|
|
try {
|
|
|
wfManager.getWfInfo();
|
|
|
String orderbytype = Util.null2String(wfManager.getOrderbytype());
|
|
|
if ("2".equals(orderbytype)) {
|
|
|
orderby = "asc";
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
}
|
|
|
WFLinkInfo wfinf = new WFLinkInfo();
|
|
|
int nodeattribute = 0;
|
|
|
if (nodeid > 0)
|
|
|
nodeattribute = wfinf.getNodeAttribute(nodeid);
|
|
|
int viewtypeall = 0;
|
|
|
int viewdescall = 0;
|
|
|
int showtype = 0;
|
|
|
int vtapprove = 0;
|
|
|
int vtrealize = 0;
|
|
|
int vtforward = 0;
|
|
|
int vtTakingOpinions = 0;
|
|
|
int vtHandleForward = 0;
|
|
|
int vtpostil = 0;
|
|
|
int vttpostil = 0;
|
|
|
int vtrecipient = 0;
|
|
|
int vtrpostil = 0;
|
|
|
int vtreject = 0;
|
|
|
int vtsuperintend = 0;
|
|
|
int vtover = 0;
|
|
|
int vtintervenor = 0;
|
|
|
int vtChuanyue = 0;
|
|
|
int vtChuanyueRec = 0;
|
|
|
int vtTakForward = 0;
|
|
|
int vtTakEnd = 0;
|
|
|
int vtWithdraw = 0;
|
|
|
int vdcomments = 0;
|
|
|
int vddeptname = 0;
|
|
|
int vdoperator = 0;
|
|
|
int vddate = 0;
|
|
|
int vdtime = 0;
|
|
|
int stnull = 0;
|
|
|
int vsignupload = 0;
|
|
|
int vmobilesource = 0;
|
|
|
int vsigndoc = 0;
|
|
|
int vsignworkflow = 0;
|
|
|
int remarkcolumn = 1;
|
|
|
int languageid = 7;
|
|
|
int selectformat = 0;
|
|
|
int vdposition = 0;
|
|
|
int vdsub = 0;
|
|
|
int vdjob = 0;
|
|
|
int vdnodename = 0;
|
|
|
int vdaction = 0;
|
|
|
String showDesc = "";
|
|
|
String signShowDesc = "";
|
|
|
String printviewdesc = "";
|
|
|
String viewtypeallValue = "";
|
|
|
if (user != null) {
|
|
|
languageid = user.getLanguage();
|
|
|
}
|
|
|
String ORwhere = "";
|
|
|
String appendORwhere = "";
|
|
|
Set<String> logTypeSet = new HashSet<>();
|
|
|
Set<String> logIdSet = null;
|
|
|
Map<String,Object> postilMap = new HashMap<>();//批注的类型
|
|
|
|
|
|
//判断当前节点是否是自由节点
|
|
|
int node_temp = currentnodeid;
|
|
|
rs.execute("select isfreenode,startnodeid from workflow_nodebase where id = " + currentnodeid);
|
|
|
if (rs.next()) {
|
|
|
int isfreenode = rs.getInt(1);
|
|
|
if (isfreenode == 1) {
|
|
|
node_temp = rs.getInt(2);//当前节点是自由节点,取自由节点发起节点的配置
|
|
|
}
|
|
|
}
|
|
|
node_temp = FreeNodeBiz.getExtendNodeId(node_temp);
|
|
|
String sql = "select * from workflow_flownode where workflowid=" + workflowid + " and nodeid=" + node_temp;
|
|
|
rs.executeSql(sql);
|
|
|
if (rs.next()) {
|
|
|
viewtypeall = Util.getIntValue(rs.getString("viewtypeall"), 0);
|
|
|
viewdescall = Util.getIntValue(rs.getString("viewdescall"), 0);
|
|
|
showtype = Util.getIntValue(rs.getString("showtype"), 0);
|
|
|
vtapprove = Util.getIntValue(rs.getString("vtapprove"), 0);
|
|
|
vtrealize = Util.getIntValue(rs.getString("vtrealize"), 0);
|
|
|
vtforward = Util.getIntValue(rs.getString("vtforward"), 0);
|
|
|
vtTakingOpinions = Util.getIntValue(rs.getString("vtTakingOpinions"), 0); //征求意见
|
|
|
vtHandleForward = Util.getIntValue(rs.getString("vtHandleForward"), 0); // 转办
|
|
|
vttpostil = Util.getIntValue(Util.null2String(rs.getString("vttpostil")), 0);
|
|
|
vtrpostil = Util.getIntValue(Util.null2String(rs.getString("vtrpostil")), 0);
|
|
|
vtpostil = Util.getIntValue(rs.getString("vtpostil"), 0);
|
|
|
vtrecipient = Util.getIntValue(rs.getString("vtrecipient"), 0);
|
|
|
vtreject = Util.getIntValue(rs.getString("vtreject"), 0);
|
|
|
vtsuperintend = Util.getIntValue(rs.getString("vtsuperintend"), 0);
|
|
|
vtover = Util.getIntValue(rs.getString("vtover"), 0);
|
|
|
vtintervenor = Util.getIntValue(rs.getString("vtintervenor"), 0);
|
|
|
vtChuanyue = Util.getIntValue(rs.getString("vtChuanyue"), 0);
|
|
|
vtChuanyueRec = Util.getIntValue(rs.getString("vtChuanyueRec"), 0);
|
|
|
vtTakForward = Util.getIntValue(rs.getString("vttakforward"), 0);
|
|
|
vtTakEnd = Util.getIntValue(rs.getString("vttakend"), 0);
|
|
|
vtWithdraw = Util.getIntValue(rs.getString("vtWithdraw"), 0);
|
|
|
vdcomments = Util.getIntValue(rs.getString("vdcomments"), 0);
|
|
|
vddeptname = Util.getIntValue(rs.getString("vddeptname"), 0);
|
|
|
vdoperator = Util.getIntValue(rs.getString("vdoperator"), 0);
|
|
|
vddate = Util.getIntValue(rs.getString("vddate"), 0);
|
|
|
vdtime = Util.getIntValue(rs.getString("vdtime"), 0);
|
|
|
stnull = Util.getIntValue(rs.getString("stnull"), 0);
|
|
|
vsignupload = Util.getIntValue(rs.getString("vsignupload"), 0);
|
|
|
vmobilesource = Util.getIntValue(rs.getString("vmobilesource"), -1);
|
|
|
vsigndoc = Util.getIntValue(rs.getString("vsigndoc"), 0);
|
|
|
vsignworkflow = Util.getIntValue(rs.getString("vsignworkflow"), 0);
|
|
|
remarkcolumn = Util.getIntValue(rs.getString("remarkcolumn"), 1);
|
|
|
selectformat = Util.getIntValue(rs.getString("selectformat"), 0);
|
|
|
vdsub = Util.getIntValue(rs.getString("vdsub"), 0);
|
|
|
vdjob = Util.getIntValue(rs.getString("vdjob"), 0);
|
|
|
vdnodename = Util.getIntValue(rs.getString("vdnodename"), 0);
|
|
|
vdposition = Util.getIntValue(rs.getString("vdposition"), 0);
|
|
|
vdaction = Util.getIntValue(rs.getString("vdaction"), 0);
|
|
|
showDesc = Util.null2String(rs.getString("showdesc"));
|
|
|
signShowDesc = Util.null2String(rs.getString("signshowdesc"));
|
|
|
//如果是打印获取签字意见
|
|
|
if (Isprint == 1) {
|
|
|
showDesc = Util.null2String(rs.getString("printshowdesc"));
|
|
|
signShowDesc = Util.null2String(rs.getString("printsignshowdesc"));
|
|
|
selectformat = Util.getIntValue(rs.getString("printselectformat"), 0);
|
|
|
printviewdesc = Util.null2String(rs.getString("printviewdesc"));
|
|
|
remarkcolumn = Util.getIntValue(rs.getString("PRINTREMARKCOLUMN"), 1);
|
|
|
viewtypeallValue = Util.null2String(rs.getString("printviewtype"));
|
|
|
showtype = Util.getIntValue(rs.getString("printshowtype"), 0);
|
|
|
stnull = Util.getIntValue(rs.getString("printstnull"), 0);
|
|
|
int nodesignset = 0;
|
|
|
RecordSet rszz = new RecordSet();
|
|
|
rszz.executeQuery("select * from workflow_printset where type=? and modeid=?", ismode == 0 ? 2 : 1, printModeId);
|
|
|
while (rszz.next()) {
|
|
|
nodesignset = ListUtil.ToZero(rszz.getInt("nodesignset"));
|
|
|
//如果此模板有进行设置
|
|
|
if (nodesignset == 1) {
|
|
|
selectformat = ListUtil.ToZero(rszz.getInt("selectformat"));
|
|
|
remarkcolumn = Util.getIntValue(rszz.getString("REMARKCOLUMN"), 1);
|
|
|
viewtypeallValue = Util.null2String(rszz.getString("viewtype"));
|
|
|
showtype = Util.getIntValue(rszz.getString("showtype"), 0);
|
|
|
stnull = Util.getIntValue(rszz.getString("stnull"), 0);
|
|
|
//如果是模板模式 没有自定义的签字意见 只能是普通
|
|
|
if (ismode == 0) {
|
|
|
selectformat = 0;
|
|
|
}
|
|
|
//并且是自定义设置
|
|
|
if (selectformat == 1) {
|
|
|
showDesc = rszz.getString("showdesc");
|
|
|
signShowDesc = rszz.getString("signShowDesc");
|
|
|
} else {
|
|
|
//如果是默认设置 那么也应该取模板上面的设置
|
|
|
printviewdesc = rszz.getString("viewdesc");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//使用默认格式
|
|
|
if (selectformat != 1&&!ShowTypeEnum.OLDVALUE.equals(printviewdesc)) {
|
|
|
vdcomments = 0;
|
|
|
vddeptname = 0;
|
|
|
vdoperator = 0;
|
|
|
vddate = 0;
|
|
|
vdtime = 0;
|
|
|
vsigndoc = 0;
|
|
|
vsignworkflow = 0;
|
|
|
vmobilesource = 0;
|
|
|
vsignupload = 0;
|
|
|
vdaction = 0;
|
|
|
vdposition = 0;
|
|
|
viewdescall=0;
|
|
|
vdsub = 0;
|
|
|
vdjob = 0;
|
|
|
vdnodename = 0;
|
|
|
if ("1".equals(printviewdesc) || "all".equals(printviewdesc)) {
|
|
|
viewdescall = 1;
|
|
|
vmobilesource=1;
|
|
|
} else {
|
|
|
List<String> valueList = Util.splitString2List(printviewdesc, ",");
|
|
|
if (valueList.size() == ShowTypeEnum.values().length) {
|
|
|
viewdescall = 1;
|
|
|
vmobilesource=1;
|
|
|
} else {
|
|
|
if (printviewdesc.indexOf("viewdesc_comments") > -1) {
|
|
|
vdcomments = 1;
|
|
|
}
|
|
|
if (printviewdesc.indexOf("viewdesc_deptname") > -1) {
|
|
|
vddeptname = 1;
|
|
|
}
|
|
|
if (printviewdesc.indexOf("viewdesc_operator") > -1) {
|
|
|
vdoperator = 1;
|
|
|
}
|
|
|
if (printviewdesc.indexOf("viewdesc_date") > -1) {
|
|
|
vddate = 1;
|
|
|
}
|
|
|
if (printviewdesc.indexOf("viewdesc_time") > -1) {
|
|
|
vdtime = 1;
|
|
|
}
|
|
|
if (printviewdesc.indexOf("viewdesc_signdoc") > -1) {
|
|
|
vsigndoc = 1;
|
|
|
}
|
|
|
if (printviewdesc.indexOf("viewdesc_signworkflow") > -1) {
|
|
|
vsignworkflow = 1;
|
|
|
}
|
|
|
if (printviewdesc.indexOf("viewdesc_mobilesource") > -1) {
|
|
|
vmobilesource = 1;
|
|
|
}
|
|
|
if (printviewdesc.indexOf("viewdesc_signupload") > -1) {
|
|
|
vsignupload = 1;
|
|
|
}
|
|
|
if (printviewdesc.indexOf("viewdesc_action") > -1) {
|
|
|
vdaction = 1;
|
|
|
}
|
|
|
if (printviewdesc.indexOf("viewdesc_position") > -1) {
|
|
|
vdposition = 1;
|
|
|
}
|
|
|
if (printviewdesc.indexOf("viewdesc_subname") > -1) {
|
|
|
vdsub = 1;
|
|
|
}
|
|
|
if (printviewdesc.indexOf("viewdesc_jobname") > -1) {
|
|
|
vdjob = 1;
|
|
|
}
|
|
|
if (printviewdesc.indexOf("viewdesc_nodename") > -1) {
|
|
|
vdnodename = 1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!ShowTypeEnum.OLDVALUE.equals(viewtypeallValue)) {
|
|
|
viewtypeall = 0;
|
|
|
vtapprove = 0;
|
|
|
vtrealize = 0;
|
|
|
vtforward = 0;
|
|
|
vtpostil = 0;
|
|
|
vtHandleForward = 0;
|
|
|
vtTakingOpinions = 0;
|
|
|
vttpostil = 0;
|
|
|
vtrecipient = 0;
|
|
|
vtrpostil = 0;
|
|
|
vtreject = 0;
|
|
|
vtsuperintend = 0;
|
|
|
vtover = 0;
|
|
|
vtintervenor = 0;
|
|
|
vtWithdraw = 0;
|
|
|
if (viewtypeallValue.indexOf("viewtype_all") != -1 || viewtypeallValue.equals("1") || "all".equals(viewtypeallValue)) {
|
|
|
viewtypeall = 1;
|
|
|
|
|
|
} else {
|
|
|
if (viewtypeallValue.indexOf("viewtype_approve") != -1)
|
|
|
vtapprove = 1;
|
|
|
if (viewtypeallValue.indexOf("viewtype_realize") != -1)
|
|
|
vtrealize = 1;
|
|
|
if (viewtypeallValue.indexOf("viewtype_forward") != -1)
|
|
|
vtforward = 1;
|
|
|
if (viewtypeallValue.indexOf("viewtype_postil") != -1)
|
|
|
vtpostil = 1;
|
|
|
if (viewtypeallValue.indexOf("view_handleForward") != -1)
|
|
|
vtHandleForward = 1;
|
|
|
if (viewtypeallValue.indexOf("view_takingOpinions") != -1)
|
|
|
vtTakingOpinions = 1;
|
|
|
if (viewtypeallValue.indexOf("viewtype_tpostil") != -1)
|
|
|
vttpostil = 1;
|
|
|
if (viewtypeallValue.indexOf("viewtype_recipient") != -1)
|
|
|
vtrecipient = 1;
|
|
|
if (viewtypeallValue.indexOf("viewtype_rpostil") != -1)
|
|
|
vtrpostil = 1;
|
|
|
if (viewtypeallValue.indexOf("viewtype_reject") != -1)
|
|
|
vtreject = 1;
|
|
|
if (viewtypeallValue.indexOf("viewtype_superintend") != -1)
|
|
|
vtsuperintend = 1;
|
|
|
if (viewtypeallValue.indexOf("viewtype_over") != -1)
|
|
|
vtover = 1;
|
|
|
if (viewtypeallValue.indexOf("viewtype_intervenor") != -1)
|
|
|
vtintervenor = 1;
|
|
|
if (viewtypeallValue.indexOf("viewtype_withdraw") != -1)
|
|
|
vtWithdraw = 1;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (viewtypeall != 1) {
|
|
|
if (vtapprove == 1) { //提交
|
|
|
ORwhere += " or logtype='2'";
|
|
|
}
|
|
|
if (vtrealize == 1) { //批准
|
|
|
ORwhere += " or logtype='0'";
|
|
|
}
|
|
|
if (vtforward == 1) { //转发
|
|
|
ORwhere += " or logtype='7'";
|
|
|
}
|
|
|
if (vtTakingOpinions == 1) { //征求意见
|
|
|
ORwhere += " or logtype='a'";
|
|
|
}
|
|
|
if (vtHandleForward == 1) { //转办
|
|
|
ORwhere += " or logtype='h'";
|
|
|
}
|
|
|
if (vttpostil == 1) { //回复
|
|
|
ORwhere += " or logtype='b'";
|
|
|
}
|
|
|
if (vtrpostil == 1) { //抄送批注----这里之前应该是搞错了,导致现在如果设置只显示抄送批注签字意见,会导致转办反馈的签字意见也跟着显示出来
|
|
|
ORwhere += " or logtype='9'";
|
|
|
}
|
|
|
if (vtpostil == 1) { //批注
|
|
|
ORwhere += " or logtype='9'";
|
|
|
postilMap.put("viewtype_postil","9");
|
|
|
}
|
|
|
if (vtrecipient == 1) { //抄送
|
|
|
ORwhere += " or logtype='t'";
|
|
|
}
|
|
|
if (vtreject == 1) { //退回
|
|
|
ORwhere += " or logtype='3'";
|
|
|
}
|
|
|
if (vtsuperintend == 1) { //督办
|
|
|
ORwhere += " or logtype='s'";
|
|
|
}
|
|
|
if (vtover == 1) { //强制归档
|
|
|
ORwhere += " or logtype='e'";
|
|
|
}
|
|
|
if (vtintervenor == 1) { //流程干预
|
|
|
ORwhere += " or logtype='i'";
|
|
|
}
|
|
|
if (vtChuanyue == 1) { //传阅
|
|
|
ORwhere += " or logtype='c'";
|
|
|
}
|
|
|
if (vtChuanyueRec == 1) { //传阅批示
|
|
|
ORwhere += " or logtype='y'";
|
|
|
}
|
|
|
if (vtTakForward == 1) {//征询转办
|
|
|
ORwhere += " or logtype='z'";
|
|
|
}
|
|
|
if (vtTakEnd == 1) {//结束征询
|
|
|
ORwhere += " or logtype='x'";
|
|
|
}
|
|
|
if (vtWithdraw == 1) {//结束征询
|
|
|
ORwhere += " or logtype='r'";
|
|
|
}
|
|
|
ORwhere = ORwhere.trim();
|
|
|
if ("".equals(ORwhere))
|
|
|
ORwhere = " 1=2";
|
|
|
else
|
|
|
ORwhere = ORwhere.substring(2);
|
|
|
}
|
|
|
|
|
|
if(vtrpostil == 1){
|
|
|
postilMap.put("viewtype_rpostil","9");
|
|
|
}
|
|
|
|
|
|
|
|
|
if(entity != null){
|
|
|
ORwhere = "";
|
|
|
Map<String, Object> showTypes = entity.getShowType();
|
|
|
postilMap.clear();
|
|
|
postilMap.putAll(showTypes);
|
|
|
Collection<Object> values = showTypes.values();
|
|
|
Iterator<Object> iterator = values.iterator();
|
|
|
Map<String, String> signInputMap = ShowType.getSignInputMap();
|
|
|
Map<String, String> valueMap = new HashMap<>();
|
|
|
for(Map.Entry<String,String> entry : signInputMap.entrySet()){
|
|
|
String key = entry.getValue();
|
|
|
String value = entry.getKey();
|
|
|
valueMap.put(value,key);
|
|
|
if("1".equals(entity.getIsGroup())){
|
|
|
appendORwhere += " or logtype='"+value+"'";
|
|
|
}
|
|
|
}
|
|
|
while(iterator.hasNext()){
|
|
|
String next = Util.null2String(iterator.next());
|
|
|
String logtype = Util.null2String(valueMap.get(next));
|
|
|
if("1".equals(entity.getIsGroup())){
|
|
|
if(signInputMap.values().contains(next) && !"".equals(logtype) && values.contains(logtype)){
|
|
|
//doto 可能需要做其他事情
|
|
|
} else {
|
|
|
ORwhere += " or logtype='"+next+"'";
|
|
|
}
|
|
|
logTypeSet.add(next);
|
|
|
} else {
|
|
|
ORwhere += " or logtype='"+next+"'";
|
|
|
}
|
|
|
}
|
|
|
ORwhere = ORwhere.trim();
|
|
|
if ("".equals(ORwhere))
|
|
|
ORwhere = " 1=2";
|
|
|
else
|
|
|
ORwhere = ORwhere.substring(2);
|
|
|
}
|
|
|
|
|
|
|
|
|
//二次认证,数据保护的验证
|
|
|
Map<String, Object> checkMap = SecondAuthBiz.getProtectedLogs(Requestid);
|
|
|
Map<String, String> logIdMap = (HashMap<String, String>) checkMap.get("logIdMap");
|
|
|
//批量获取契约锁认证的信息
|
|
|
Map<String, Object> qysSignInfoMap = SecondAuthBiz.getMultiQYSSignInfo(Requestid,nodeid);
|
|
|
|
|
|
//拼接查询SQL,区分当前请求意见、还是主子流程意见
|
|
|
String backfields="", fromSql="", sqlWhere="";
|
|
|
boolean siblingOtherType = false;
|
|
|
if(this.mainSubSignEntity.getType() > 10) {
|
|
|
//判断是否平行流程其他类型
|
|
|
String sibling = "select distinct WORKFLOWID from workflow_requestlog where nodeid = "+nodeid;
|
|
|
RecordSet rs2 = new RecordSet();
|
|
|
rs2.executeQuery(sibling);
|
|
|
rs2.next();
|
|
|
String thisworkflowid = rs2.getString(1);
|
|
|
if(!thisworkflowid.equals(workflowid+"")){
|
|
|
siblingOtherType = true;
|
|
|
}
|
|
|
//平行流程意见
|
|
|
backfields = " a.* ";
|
|
|
fromSql = " workflow_requestlog a,hrmsubcompany b,hrmdepartment c,HRMRESOURCE d ";
|
|
|
sqlWhere = " where a.OPERATORDEPT = c.ID and a.OPERATORSUB = b.id and a.operator = d.id and a.nodeid in ( \n" + nodeid +
|
|
|
" ) and a.requestid in (select requestid from workflow_requestbase where MAINREQUESTID = \n" +
|
|
|
" (select mainrequestid from workflow_requestbase where requestid = " + Requestid + ")) ";
|
|
|
new BaseBean().writeLog("fieldinfo---fromSql----->" + fromSql + fromSql + sqlWhere);
|
|
|
}else if(this.mainSubSignEntity.getType() > 0){
|
|
|
//主子流程意见
|
|
|
MainSubWfSignBiz biz = new MainSubWfSignBiz();
|
|
|
biz.generateSqlInfo(this.mainSubSignEntity, this.Requestid);
|
|
|
backfields = this.mainSubSignEntity.getBackfields();
|
|
|
fromSql = this.mainSubSignEntity.getFromSql();
|
|
|
sqlWhere = this.mainSubSignEntity.getSqlWhere();
|
|
|
}else{
|
|
|
//当前流程意见
|
|
|
backfields = " t1.* ";
|
|
|
fromSql = " workflow_requestlog t1 left join hrmresource t2 on t1.operator = t2.id ";
|
|
|
fromSql += " left join (" +
|
|
|
"select nodeid,nodeorder,0 as isfreenode from workflow_flownode where workflowid="+workflowid+" " +
|
|
|
" union select a.id, b.nodeorder, 1 as isfreenode from workflow_freenode a " +
|
|
|
"left join workflow_flownode b on a.extendnodeid = b.nodeid where a.requestid = "+Requestid+" and b.workflowid = " + workflowid +
|
|
|
") t3 on t1.nodeid=t3.nodeid ";
|
|
|
|
|
|
if (nodeid == -2) {
|
|
|
fromSql += " left join hrmdepartment t4 on t2.departmentid=t4.id ";
|
|
|
} else if (nodeid == -3) {
|
|
|
fromSql += " left join hrmsubcompany t4 on t2.subcompanyid1=t4.id ";
|
|
|
}
|
|
|
|
|
|
sqlWhere = "where t1.workflowid=" + workflowid + " and t1.requestid=" + Requestid + " and t1.logtype!='1' ";
|
|
|
|
|
|
if (nodeid > 0) {
|
|
|
sqlWhere += " and t1.nodeid = " + nodeid;
|
|
|
} else if (belongGroup || nodeid == RequestConstant.ALL_NODE_SIGN_MARK){
|
|
|
sqlWhere += "";
|
|
|
} else {
|
|
|
sqlWhere += " and t1.nodeid in ("+getAllFreeNodeIds()+")";
|
|
|
}
|
|
|
|
|
|
//排除已删除的节点签字意见
|
|
|
rs.executeQuery("select a.nodeid from workflow_flownode_dellog a ,workflow_requestbase b where a.workflowid = b.workflowid and b.requestid = ?",Requestid);
|
|
|
List<String> delnode = new ArrayList<>();
|
|
|
while (rs.next()){
|
|
|
delnode.add(rs.getString("nodeid"));
|
|
|
}
|
|
|
if(delnode.size() > 0){
|
|
|
sqlWhere += " and "+Util.getSubINClause(String.join(",",delnode),"t1.nodeid","not in");
|
|
|
}
|
|
|
|
|
|
//添加权限判断
|
|
|
RequestRemarkRight remarkRight = new RequestRemarkRight();
|
|
|
String sqlcondition = remarkRight.getRightCondition(Requestid, workflowid, user.getUID());
|
|
|
sqlWhere += sqlcondition;
|
|
|
if (nodeattribute == 1 && nodeid > 0) {
|
|
|
sqlWhere += " and logid in(select max(logid) from workflow_requestlog where workflowid=" + workflowid + " and requestid=" + Requestid + " and logtype!='1' and nodeid=" + nodeid
|
|
|
+ " group by operator,operatortype,operatedate,operatetime,logid)";
|
|
|
}
|
|
|
ArrayList forklogids = wfinf.ForkStartLogids(Requestid, workflowid);
|
|
|
if (forklogids.size() > 0) {
|
|
|
sqlWhere += " and " + Util.getSubINClause(StringUtils.join(forklogids, ","), "t1.logid", "not in");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
String groupOrder = " ASC ";
|
|
|
String orderBy = " operatedate desc,operatetime desc, logid";
|
|
|
int groupOrderType = 0;
|
|
|
if(entity != null){
|
|
|
// if(entity.getShowScope() == 2){ //暂时注释
|
|
|
// sqlWhere += " and t2.seclevel >=" + entity.getMinLevel() + " and t2.seclevel <= " + entity.getMaxLevel();
|
|
|
// }
|
|
|
String orderByTemp = "";
|
|
|
|
|
|
groupOrderType = entity.getGroupOrderType();
|
|
|
|
|
|
Iterator<Map<String, Object>> iterator = entity.getShowOrder().iterator();
|
|
|
while(iterator.hasNext()){
|
|
|
Map<String, Object> next = iterator.next();
|
|
|
int id = Util.getIntValue(Util.null2String(next.get("id")),0);
|
|
|
String order = Util.null2String(next.get("order"));
|
|
|
if(id == 1){//人员显示顺序
|
|
|
orderByTemp += ",t2.dsporder " + order;
|
|
|
} else if(id == 2){//安全级别
|
|
|
orderByTemp += ",t2.seclevel " + order;
|
|
|
} else if(id == 3){//操作类型
|
|
|
orderByTemp += ",t1.logtype " + order;
|
|
|
} else if(id == 4){//操作时间
|
|
|
orderByTemp += ",t1.operatedate "+order+", t1.operatetime " + order;
|
|
|
} else if(id == 5){//节点
|
|
|
orderByTemp += ",t3.nodeorder " + order;
|
|
|
}
|
|
|
}
|
|
|
if(!"".equals(orderByTemp)){
|
|
|
orderByTemp = orderByTemp.substring(1);
|
|
|
}
|
|
|
|
|
|
if(showtype == 0){//处理显示最后一次签字意见设置,下方循环意见代码先处理空意见再处理最后一次意见,签字意见框没有单独保存过走默认排序下无需处理
|
|
|
//showtype---显示类型 0:显示最后一次意见 1:显示全部
|
|
|
//stnull---是否显示空意见 0:显示空意见 1:不显示空意见
|
|
|
logIdSet = new HashSet<>();
|
|
|
String logIds = "";
|
|
|
Set<String> operators_nodeidtmp = new HashSet<>();
|
|
|
//Set<Integer> nodeids = new HashSet<>();
|
|
|
String sqlTemp = "select t1.logid,t1.operator,t1.nodeid,t1.logtype,t1.agenttype,t1.agentorbyagentid from " + fromSql + " " + sqlWhere;
|
|
|
if (!ORwhere.equals(""))
|
|
|
sqlTemp += " and (" + ORwhere + ") ";
|
|
|
if(stnull == 1){//不显示空意见,排除空意见后再按照时间倒序取最后一次节点签字意见
|
|
|
String dbType = rs.getOrgindbtype();
|
|
|
if("oracle".equals(dbType)){
|
|
|
sqlTemp += " and t1.remark is not null and DBMS_LOB.GETLENGTH(t1.remark) > 0 ";
|
|
|
}else if("sqlserver".equals(dbType)){
|
|
|
sqlTemp += " and t1.remark is not null and datalength(t1.remark) >0 ";
|
|
|
}else if("mysql".equals(dbType)){
|
|
|
sqlTemp += " and t1.remark is not null and t1.remark <>'' ";
|
|
|
}else{
|
|
|
sqlTemp += " and t1.remark is not null ";
|
|
|
}
|
|
|
}
|
|
|
sqlTemp += " order by operatedate desc,operatetime desc ";
|
|
|
Map<String, String> signInputMap = ShowType.getSignInputMap();
|
|
|
rs.executeQuery(sqlTemp);
|
|
|
while(rs.next()){
|
|
|
|
|
|
Integer operator = rs.getInt("operator");
|
|
|
String logType = rs.getString("logType");
|
|
|
String logId = rs.getString("logId");
|
|
|
Integer nodeidtmp = rs.getInt("nodeid");//仅按照节点意见分组时,区分意见节点
|
|
|
int agenttype = Util.getIntValue(rs.getString("agenttype"));
|
|
|
int agentorByAgentId = rs.getInt("agentorbyagentid");
|
|
|
|
|
|
if (agenttype > 0) {
|
|
|
if(!operators_nodeidtmp.contains(agentorByAgentId + "_" + nodeidtmp)) {
|
|
|
operators_nodeidtmp.add(agentorByAgentId + "_" + nodeidtmp);
|
|
|
logIds += "," + logId;
|
|
|
logIdSet.add(logId);
|
|
|
}
|
|
|
} else {
|
|
|
if (!operators_nodeidtmp.contains(operator+"_"+nodeidtmp)) {
|
|
|
operators_nodeidtmp.add(operator + "_" + nodeidtmp);
|
|
|
logIds += "," + logId;
|
|
|
logIdSet.add(logId);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*if(!nodeids.contains(nodeid1)) {
|
|
|
nodeids.add(nodeid1);
|
|
|
}*/
|
|
|
|
|
|
if(signInputMap.get(logType) != null){
|
|
|
logIds += "," + logId;
|
|
|
}
|
|
|
}
|
|
|
if(!"".equals(logIds)){
|
|
|
logIds = logIds.substring(1);
|
|
|
// sqlWhere += " and logid in ("+logIds+")";
|
|
|
}
|
|
|
}
|
|
|
orderBy = ("".equals(orderByTemp) ? "t1.operatedate desc,t1.operatetime desc" : orderByTemp) + ",t1.logid";
|
|
|
}
|
|
|
|
|
|
if(groupOrderType == 2 || groupOrderType == 3){//2.时间正序 3.时间倒序
|
|
|
}else{
|
|
|
groupOrder = groupOrderType==1?" DESC ":" ASC ";
|
|
|
//添加分组排序
|
|
|
if (nodeid == -1) {//节点
|
|
|
orderBy = " t3.nodeorder " + groupOrder + ", t3.isfreenode, " + orderBy;
|
|
|
} else if(nodeid == -2 || nodeid == -3) {//部门、分部
|
|
|
orderBy = " t4.showorder " + groupOrder + ", t4.id " + groupOrder + "," + orderBy;
|
|
|
}
|
|
|
}
|
|
|
orderBy = " order by " + orderBy;
|
|
|
|
|
|
ORwhere += appendORwhere;
|
|
|
List<Map<String,String>> dataArr = getRemarkList(backfields,fromSql,sqlWhere,ORwhere,orderBy,workflowid,Requestid,logTypeSet,logIdSet,true);
|
|
|
boolean postil = (postilMap.containsKey("viewtype_postil") && !postilMap.containsKey("viewtype_rpostil")) || (!postilMap.containsKey("viewtype_postil") && postilMap.containsKey("viewtype_rpostil"));
|
|
|
Set<Integer> logIdFielters = new HashSet<>();
|
|
|
Map<String,List<RemarkInfoDTO>> remarkListMap = new HashMap<>();
|
|
|
List<Integer> remarkKeys = new ArrayList<>();
|
|
|
List<Map<String,String>> remarkList_date = new ArrayList<>();
|
|
|
Map<Integer, String> freeNodeNameMap = getFreeNodeName(Requestid);
|
|
|
RobotNodeServiceBiz robotNodeServiceBiz = new RobotNodeServiceBiz(languageid);
|
|
|
if (ismode == 2) {//html模式
|
|
|
List<RemarkInfoDTO> remarkList = new ArrayList<RemarkInfoDTO>();
|
|
|
for(Map<String,String> params : dataArr){
|
|
|
int currequestid = param2Integer(params,"requestid");
|
|
|
remarkRequestid = currequestid;
|
|
|
int agenttype = param2Integer(params,"agenttype");
|
|
|
int agentorbyagentid = param2Integer(params,"agentorbyagentid");
|
|
|
int operator = param2Integer(params,"operator");
|
|
|
String seclevellog = param2String(params, "seclevel");
|
|
|
int logId = param2Integer(params,"logId");
|
|
|
int operatortype = param2Integer(params,"operatortype");
|
|
|
int requestLogId = param2Integer(params,"requestLogId");
|
|
|
int nodeid_temp = param2Integer(params,"nodeid");
|
|
|
String isRobotNode = params.get("isrobotnode");
|
|
|
//机器人节点
|
|
|
NodeInfoEntity nodeInfoEntity = com.engine.workflow.biz.workflowCore.WorkflowBaseBiz.getNodeInfo(nodeid_temp);
|
|
|
if((operator+"").equals(RobotNodeBiz.operatorid) && (NodeType.WAIT.getValue().equals(nodeInfoEntity.getNodetype()+"") || NodeType.AUTOPROCESS.getValue().equals(nodeInfoEntity.getNodetype()+""))){
|
|
|
//机器人节点
|
|
|
String remarkOperation = new RobotNodeServiceBiz().getRobotNodeSet(nodeid_temp).getRemarkOperation();
|
|
|
if("0".equals(remarkOperation) && "1".equals(isRobotNode)){
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
String annexdocids = param2String(params,"annexdocids");
|
|
|
String signdocids = param2String(params,"signdocids");
|
|
|
String signworkflowids = param2String(params,"signworkflowids");
|
|
|
int operatorDept = param2Integer(params,"operatorDept");
|
|
|
int operatorSub = param2Integer(params,"operatorSub");
|
|
|
int operatorJob = param2Integer(params,"operatorJob");
|
|
|
int operatorNodeId = param2Integer(params,"nodeid");
|
|
|
String logtype = param2String(params,"logtype");
|
|
|
String remark = param2String(params,"remark");
|
|
|
String operatedate = param2String(params,"operatedate");
|
|
|
String operatetime = param2String(params,"operatetime");
|
|
|
String appHandWrittenSignID = param2String(params,"HandWrittenSign");
|
|
|
int appSpeechAttahmentID = param2Integer(params,"SpeechAttachment");
|
|
|
String speechAttachmente9 = param2String (params,"speechAttachmente9");
|
|
|
String remarkLocation = param2String(params,"remarkLocation");
|
|
|
String isMobile = param2String(params,"isMobile");
|
|
|
String fulltextannotation = param2String(params,"fulltextannotation");
|
|
|
String remarkSrc = "";
|
|
|
|
|
|
//去除默认签字意见大小的div
|
|
|
remark = processDefaultFontSizeDiv(remark);
|
|
|
|
|
|
//去除重复的记录
|
|
|
if(logIdFielters.contains(logId)){
|
|
|
continue;
|
|
|
}
|
|
|
logIdFielters.add(logId);
|
|
|
|
|
|
if(entity != null){
|
|
|
//意见显示范围
|
|
|
if(entity.getShowScope() == 2) {
|
|
|
int seclevel = 0;
|
|
|
if (seclevellog.equals("")) {
|
|
|
seclevel = Util.getIntValue(resourcecominfo.getSeclevel(operator+""),0);
|
|
|
if (agenttype == 2 && agentorbyagentid > 0) {
|
|
|
seclevel = Util.getIntValue(resourcecominfo.getSeclevel(agentorbyagentid+""),0);
|
|
|
}
|
|
|
//外部用户
|
|
|
if(operatortype == 1){
|
|
|
seclevel = Util.getIntValue(crmcominfo.getSeclevel(operator+""),0);
|
|
|
}
|
|
|
} else {
|
|
|
seclevel = Util.getIntValue(seclevellog, 0);
|
|
|
}
|
|
|
if(!(seclevel >= entity.getMinLevel() && seclevel <= entity.getMaxLevel())){
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
int checkNodeId = nodeid_temp;
|
|
|
//自由节点,作为发起节点来过滤
|
|
|
if(FreeNodeBiz.isFreeNode(checkNodeId)) {
|
|
|
rs.executeQuery("select extendnodeid from workflow_freenode where id = ?", checkNodeId);
|
|
|
if (rs.next()) {
|
|
|
checkNodeId = Util.getIntValue(rs.getString(1));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//显示意见节点范围
|
|
|
String nodeScopeIds = "," + entity.getNodeScopeIds() + ",";
|
|
|
if (entity.getNodeScopeType() == 1 && nodeScopeIds.indexOf("," + checkNodeId + ",") == -1) {//在节点中选择
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
if(entity.getNodeScopeType() == 2 && nodeScopeIds.indexOf("," + checkNodeId + ",") != -1) {//在节点中排除选择
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if(logtype.equals("9") && postil){//批注:被转发人批注或被抄送人提交 这种方式每次去查询性能很低
|
|
|
int calPreRemarkNodeid = nodeid == RequestConstant.ALL_NODE_SIGN_MARK ? nodeid_temp : nodeid;
|
|
|
if(calPreRemarkNodeid < 0) {
|
|
|
calPreRemarkNodeid = nodeid_temp;
|
|
|
}
|
|
|
Map<String, String> isRemarkMap = getIsRemark(currequestid, calPreRemarkNodeid, operator);
|
|
|
String preisremark = Util.null2String(isRemarkMap.get("preisremark"));
|
|
|
int takisremark = Util.getIntValue(Util.null2String(isRemarkMap.get("takisremark")));
|
|
|
|
|
|
if(postilMap.containsKey("viewtype_rpostil")) {//被转发人批注
|
|
|
if(preisremark.equals("1") && takisremark !=2){
|
|
|
continue;
|
|
|
}
|
|
|
}else if(postilMap.containsKey("viewtype_postil")){//被抄送人提交
|
|
|
if(preisremark.equals("9")){
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (operatorDept <= 0) {
|
|
|
operatorDept = Util.getIntValue(resourcecominfo.getDepartmentID("" + operator));
|
|
|
}
|
|
|
|
|
|
if (operatorSub <= 0) {
|
|
|
operatorSub = Util.getIntValue(resourcecominfo.getSubCompanyID("" + operator));
|
|
|
}
|
|
|
|
|
|
if (operatorJob <= 0) {
|
|
|
operatorJob = Util.getIntValue(resourcecominfo.getJobTitle("" + operator));
|
|
|
}
|
|
|
|
|
|
if ("t".equals(logtype)) {
|
|
|
remark = "";
|
|
|
} else {
|
|
|
if (requestLogId > 0) {//表单签章
|
|
|
rs1.executeSql(" select imageFileId from Workflow_FormSignRemark where requestLogId=" + requestLogId);
|
|
|
if (rs1.next()) {
|
|
|
int imageFileId = Util.getIntValue(rs1.getString("imageFileId"), -1);
|
|
|
if (imageFileId > -1) {
|
|
|
remark = "<img src=\""+weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fileid=" + DocDownloadCheckUtil.checkPermission(imageFileId+"",user) + "\" ></img>";
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
SignSource signSource = SignSource.getSignSource(isMobile);
|
|
|
if(signSource != null) {
|
|
|
if ("1".equals(isshowSrc)) {
|
|
|
remarkSrc = SignSource.getSignSourceNoHtml(signSource,languageid);
|
|
|
}
|
|
|
} else {
|
|
|
if ("1".equals(isshowSrc))
|
|
|
remarkSrc = wfinf.getRemarkSource2(remark);
|
|
|
else
|
|
|
remarkSrc = wfinf.getRemarkSource_WfAutoApprove(remark);
|
|
|
remark = wfinf.removeRemarkSource2(remark);
|
|
|
}
|
|
|
remark = checkRemark(remark, ismode);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
remark = appendSomeContent(remark, appHandWrittenSignID, appSpeechAttahmentID, ismode, remarkLocation,speechAttachmente9);
|
|
|
|
|
|
//签字意见添加全文批注
|
|
|
remark = appendFullTextAnnotation(remark, fulltextannotation);
|
|
|
|
|
|
if (stnull == 1 && "".equals(Util.encodeJS(toExcel(dropScript(remark))))) {//不显示空意见
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
//添加平行流程其他类型判断
|
|
|
if(siblingOtherType){
|
|
|
preoperators.clear();
|
|
|
}
|
|
|
|
|
|
//最后一次签字意见
|
|
|
if (preoperators.indexOf(operator + "_" + nodeid_temp) == -1 || belongGroup) {
|
|
|
if (showtype == 0) {
|
|
|
if(agenttype > 0){
|
|
|
if(preoperators.indexOf(agentorbyagentid + "_" + nodeid_temp) != -1) continue;
|
|
|
preoperators.add(agentorbyagentid + "_" + nodeid_temp);
|
|
|
}else{
|
|
|
preoperators.add(operator + "_" + nodeid_temp);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//姓名
|
|
|
String username_tmep = "";
|
|
|
String img = "";
|
|
|
|
|
|
String signatureImg = SecondAuthBiz.getQYSSignatureImg(logId + "", operator + "", user, logIdMap, qysSignInfoMap);
|
|
|
if (!"".equals(signatureImg)) { //优先显示契约锁数据保护或者认证时选择的章
|
|
|
img = signatureImg;
|
|
|
username_tmep = signatureImg;
|
|
|
}else {
|
|
|
if (showimg == 1) {
|
|
|
img = getNameImg(operator, ismode);
|
|
|
username_tmep = img;
|
|
|
}
|
|
|
}
|
|
|
if ("".equals(username_tmep))
|
|
|
username_tmep = resourcecominfo.getResourcename(operator + "");
|
|
|
if (operatortype == 1)
|
|
|
username_tmep = crmcominfo.getCustomerInfoname("" + operator);
|
|
|
if (operatortype == 2)
|
|
|
username_tmep = robotNodeServiceBiz.getRobotNodeSet(nodeid_temp).getOperatorName();
|
|
|
|
|
|
//操作类型
|
|
|
RequestLogOperateName requestLogOperateName = new RequestLogOperateName();
|
|
|
String operateName = "";
|
|
|
if("y".equals(logtype)) {//传阅批示
|
|
|
operateName = requestLogOperateName.getOperateName(workflowid + "", currequestid + "", nodeid_temp + "", logtype, operator + "", languageid,operatedate,operatetime);
|
|
|
}else {
|
|
|
operateName = requestLogOperateName.getOperateName(workflowid + "", currequestid + "", nodeid_temp + "", logtype, operator + "", languageid,operatedate,operatetime);
|
|
|
}
|
|
|
|
|
|
String[] datas = remarkLocation.split(",");
|
|
|
String locationText = "";
|
|
|
if (!remarkLocation.equals("") && datas.length == 4) {
|
|
|
String addr = datas[3];
|
|
|
String lng = datas[1];
|
|
|
String lat = datas[2];
|
|
|
if (Isprint == 1) {
|
|
|
locationText = SystemEnv.getHtmlLabelName(22981, user.getLanguage()) + ":" + addr;
|
|
|
} else {
|
|
|
locationText = SystemEnv.getHtmlLabelName(22981, user.getLanguage()) + ":" + "<a onclick='try {window.openlocation(\"" + remarkLocation + "\");} catch(e){openMap(" + lng + "," + lat + ",\"" + addr + "\");}' title='" + addr + "'>" + addr + "</a>";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
RemarkInfoDTO remarkInfoDTO = new RemarkInfoDTO();
|
|
|
remarkInfoDTO.setOperatedate(operatedate);
|
|
|
remarkInfoDTO.setOperatetime(operatetime);
|
|
|
if (remark.contains("/workflow/request/ViewRequestForwardSPA.jsp")) {
|
|
|
remark = remark.replace("ViewRequestForwardSPA.jsp?", "ViewRequestForwardSPA.jsp?desrequestid=" + remarkRequestid + "&");
|
|
|
}
|
|
|
remarkInfoDTO.setRemark(remark);
|
|
|
remarkInfoDTO.setRemarkSrc(remarkSrc);
|
|
|
remarkInfoDTO.setSignDocs(getSignDocs(signdocids, languageid));
|
|
|
remarkInfoDTO.setSignFlows(getSignFlows(signworkflowids, languageid));
|
|
|
remarkInfoDTO.setSignUploads(getSignUploads(annexdocids, languageid));
|
|
|
remarkInfoDTO.setUsername(username_tmep);
|
|
|
remarkInfoDTO.setOperateName(operateName);
|
|
|
remarkInfoDTO.setPosition(locationText);
|
|
|
String depname = "";
|
|
|
String subname = "";
|
|
|
String jobtitle = "";
|
|
|
remarkInfoDTO.setDeptid(operatorDept);//qc1679821 增加部门id字段
|
|
|
if(operatortype != 1){
|
|
|
depname = orgShowBiz.getDepartmentShow("workflow", operatorDept + "");
|
|
|
subname = orgShowBiz.getSubcompanyShow("workflow", operatorSub + "");
|
|
|
jobtitle = jobComInfo.getJobTitlesname(operatorJob + "");
|
|
|
}
|
|
|
remarkInfoDTO.setDepartment(depname);
|
|
|
remarkInfoDTO.setSubcompany(subname);
|
|
|
remarkInfoDTO.setJobTitle(jobtitle);
|
|
|
remarkInfoDTO.setLanguage(languageid);
|
|
|
remarkInfoDTO.setNameImg(img);
|
|
|
if (FreeNodeBiz.isFreeNode(operatorNodeId)) {
|
|
|
remarkInfoDTO.setOperatorNodeName(freeNodeNameMap.get(operatorNodeId));
|
|
|
} else {
|
|
|
remarkInfoDTO.setOperatorNodeName(workflowNodeComInfo.getNodename(operatorNodeId+""));
|
|
|
}
|
|
|
//代理信息
|
|
|
if (agenttype == 2 && agentorbyagentid > 0) {
|
|
|
remarkInfoDTO.setAgentUser(resourcecominfo.getResourcename(agentorbyagentid + ""));
|
|
|
remarkInfoDTO.setAgentDepartment(orgShowBiz.getDepartmentShow("workflow", resourcecominfo.getDepartmentID(agentorbyagentid + "")));
|
|
|
// remarkInfoDTO.setSubcompany(orgShowBiz.getSubcompanyShow("workflow", resourcecominfo.getSubCompanyID(agentorbyagentid + "")));
|
|
|
// remarkInfoDTO.setJobTitle(jobComInfo.getJobName(resourcecominfo.getJobTitle(agentorbyagentid + "")));
|
|
|
}
|
|
|
remarkList.add(remarkInfoDTO);
|
|
|
|
|
|
//分部
|
|
|
if(belongGroup){
|
|
|
String key = nodeid_temp + "";
|
|
|
if(nodeid == -2){
|
|
|
if(operatorDept >= 0) {//优先取签字意见中的部门
|
|
|
key = operatorDept + "";
|
|
|
} else {
|
|
|
key = resourcecominfo.getDepartmentID(operator+"");
|
|
|
}
|
|
|
} else if(nodeid == -3){
|
|
|
if (operatorSub >= 0) {//优先取签字意见中的分部
|
|
|
key = operatorSub + "";
|
|
|
} else {
|
|
|
key = resourcecominfo.getSubCompanyID(operator+"");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if(preoperators.indexOf(operator + "_" + nodeid_temp + "_" + key) == -1) {
|
|
|
if (showtype == 0)
|
|
|
preoperators.add(operator + "_" + nodeid_temp + "_" + key);
|
|
|
if(!remarkListMap.containsKey(key)){
|
|
|
remarkListMap.put(key,new ArrayList<>());
|
|
|
remarkKeys.add(Util.getIntValue(key));
|
|
|
}
|
|
|
remarkListMap.get(key).add(remarkInfoDTO);
|
|
|
String keytmp = key;
|
|
|
remarkList_date.add(new HashMap<String,String>(){{put(keytmp,operatedate+" "+operatetime);}});
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
if ("asc".equals(orderby)) {
|
|
|
remarkList = reverseList(remarkList);
|
|
|
}
|
|
|
//手机版只显示一列
|
|
|
if (isfromMobile == 1 || remarkcolumn == 0)
|
|
|
remarkcolumn = 1;
|
|
|
|
|
|
List<RemarkDisplayDTO> showdescByDTO = ShowType.getDisplayList();
|
|
|
//初始化显示模板remarkDispaly的数据
|
|
|
|
|
|
//如果不是默认的话 不需要showdescByDTO 只有是默认的情况下才需要这个list
|
|
|
if (selectformat != 1) {
|
|
|
//默认的需要构建dto实体类
|
|
|
for (RemarkDisplayDTO dto : showdescByDTO) {
|
|
|
dto.setIsshow(0);
|
|
|
dto.setShowtypename(getShowtypeName(dto.getShowtype(), languageid));
|
|
|
if (viewdescall == 1) {
|
|
|
dto.setIsshow(1);
|
|
|
continue;
|
|
|
}
|
|
|
if (vdcomments == 1 && dto.getShowtype() == ShowTypeEnum.COMMENTS.getId()) {
|
|
|
dto.setIsshow(1);
|
|
|
}
|
|
|
if (vmobilesource == 1 && dto.getShowtype() == ShowTypeEnum.MOBILESOURCE.getId()) {
|
|
|
dto.setIsshow(1);
|
|
|
}
|
|
|
if (vdposition == 1 && dto.getShowtype() == ShowTypeEnum.POSITION.getId()) {
|
|
|
dto.setIsshow(1);
|
|
|
}
|
|
|
if (vdsub == 1 && dto.getShowtype() == ShowTypeEnum.SUB.getId()) {
|
|
|
dto.setIsshow(1);
|
|
|
}
|
|
|
if (vdjob == 1 && dto.getShowtype() == ShowTypeEnum.JOB.getId()) {
|
|
|
dto.setIsshow(1);
|
|
|
}
|
|
|
if (vdnodename == 1 && dto.getShowtype() == ShowTypeEnum.NODE.getId()) {
|
|
|
dto.setIsshow(1);
|
|
|
}
|
|
|
if (vsigndoc == 1 && dto.getShowtype() == ShowTypeEnum.DOC.getId()) {
|
|
|
dto.setIsshow(1);
|
|
|
}
|
|
|
if (vsignworkflow == 1 && dto.getShowtype() == ShowTypeEnum.WORKFLOW.getId()) {
|
|
|
dto.setIsshow(1);
|
|
|
}
|
|
|
if (vsignupload == 1 && dto.getShowtype() == ShowTypeEnum.UPLOAD.getId()) {
|
|
|
dto.setIsshow(1);
|
|
|
}
|
|
|
if (vddeptname == 1 && dto.getShowtype() == ShowTypeEnum.DEPTNAME.getId()) {
|
|
|
dto.setIsshow(1);
|
|
|
}
|
|
|
if (vdoperator == 1 && dto.getShowtype() == ShowTypeEnum.OPERATOR.getId()) {
|
|
|
dto.setIsshow(1);
|
|
|
}
|
|
|
if (vddate == 1 && dto.getShowtype() == ShowTypeEnum.DATE.getId()) {
|
|
|
dto.setIsshow(1);
|
|
|
}
|
|
|
if (vdtime == 1 && dto.getShowtype() == ShowTypeEnum.TIME.getId()) {
|
|
|
dto.setIsshow(1);
|
|
|
}
|
|
|
if (vdaction == 1 && dto.getShowtype() == ShowTypeEnum.ACTION.getId()) {
|
|
|
dto.setIsshow(1);
|
|
|
}
|
|
|
// 操作部门和操作人同时存在时, 操作部门和操作人中间显示符号 /
|
|
|
if (vddeptname == 1 && vdoperator == 1 && dto.getShowtype() == 0) {
|
|
|
dto.setIsshow(1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
if (isfromMobile == 1)
|
|
|
remarkcolumn = 1;
|
|
|
|
|
|
//如果业务需求需要对节点、部门、分部按照大小排序,那么在这个循环之前对remarkKeys进行排序即可
|
|
|
if(belongGroup){
|
|
|
if(groupOrderType == 2 || groupOrderType == 3){
|
|
|
remarkKeys = remarksort(remarkList_date,groupOrderType);
|
|
|
}
|
|
|
for (Integer remarkKey : remarkKeys) {
|
|
|
String key = remarkKey + "";
|
|
|
List<RemarkInfoDTO> value = remarkListMap.get(key);
|
|
|
String name = "";
|
|
|
if(nodeid == -1){
|
|
|
name = WorkflowBaseBiz.getWorkflowNodeName(remarkKey);
|
|
|
} else if(nodeid == -2){
|
|
|
name = orgShowBiz.getDepartmentShow("workflow", key);
|
|
|
} else if(nodeid == -3){
|
|
|
name = orgShowBiz.getSubcompanyShow("workflow", key);
|
|
|
}
|
|
|
String content = calcRemark(value, workflowid, node_temp, remarkcolumn, languageid, showdescByDTO, selectformat, showDesc, signShowDesc);
|
|
|
Map<String,Object> nodeMark = new HashMap<>();
|
|
|
nodeMark.put("name",name);
|
|
|
nodeMark.put("content",content);
|
|
|
nodeMarkContent.add(nodeMark);
|
|
|
}
|
|
|
} else {
|
|
|
NodeRemark = calcRemark(remarkList, workflowid, node_temp, remarkcolumn, languageid, showdescByDTO, selectformat, showDesc, signShowDesc);
|
|
|
}
|
|
|
}
|
|
|
else if (ismode == 0) {//模版模式
|
|
|
for(Map<String,String> params : dataArr) {
|
|
|
int logId = param2Integer(params,"logId");
|
|
|
int agenttype = param2Integer(params, "agenttype");
|
|
|
int agentorbyagentid = param2Integer(params, "agentorbyagentid");
|
|
|
int operator = param2Integer(params, "operator");
|
|
|
int operatortype = param2Integer(params, "operatortype");
|
|
|
int requestLogId = param2Integer(params, "requestLogId");
|
|
|
int nodeid_temp = param2Integer(params, "nodeid");
|
|
|
String annexdocids = param2String(params, "annexdocids");
|
|
|
String signdocids = param2String(params, "signdocids");
|
|
|
String signworkflowids = param2String(params, "signworkflowids");
|
|
|
int operatorDept = param2Integer(params, "operatorDept");
|
|
|
String logtype = param2String(params, "logtype");
|
|
|
String remark_db = param2String(params, "remark");
|
|
|
|
|
|
//获取手写签批和语音附件 附件ID号
|
|
|
String appHandWrittenSignID = param2String(params, "HandWrittenSign");
|
|
|
int appSpeechAttahmentID = param2Integer(params, "SpeechAttachment");
|
|
|
String remarkLocation = param2String(params, "remarkLocation");
|
|
|
|
|
|
if (vmobilesource == 0 || !"1".equals(isshowSrc)) { //删除签字意见中的 来源信息
|
|
|
remark_db = wfLinkInfo.removeRemarkSource(remark_db);
|
|
|
}
|
|
|
|
|
|
//只是控制html模板中自动提交批准签字意见来源是否显示
|
|
|
if (vmobilesource == 0) {
|
|
|
remark_db = wfLinkInfo.removeRemarkFromAutoApprove(remark_db);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (operatorDept <= 0) {//只能记录下操作人的,如果有代理的情况,那被代理人的部门,只能是当前的部门了
|
|
|
operatorDept = Util.getIntValue(resourcecominfo.getDepartmentID("" + operator));
|
|
|
}
|
|
|
String remark = "";
|
|
|
String remark_check = "";//用于判断原始签字意见是否为空
|
|
|
String formsignremarkimage = "";
|
|
|
int imageFileId = -1;
|
|
|
if (!logtype.equals("t")) {
|
|
|
if (requestLogId > 0) {
|
|
|
//如果使用表单签章,则 设置表单签章内容
|
|
|
rs1.executeSql(" select imageFileId from Workflow_FormSignRemark where requestLogId=" + requestLogId);
|
|
|
if (rs1.next()) {
|
|
|
imageFileId = Util.getIntValue(rs1.getString("imageFileId"), -1);
|
|
|
}
|
|
|
//模板模式下不使用标签
|
|
|
if (imageFileId > -1) {
|
|
|
remark_check = getSeparator2() +weaver.general.GCONST.getContextPath()+ "/weaver/weaver.file.FileDownload?fileid=" + DocDownloadCheckUtil.checkPermission(imageFileId+"",user) + getSeparator2();
|
|
|
if (viewdescall == 1 || vdcomments == 1) {
|
|
|
remark = getSeparator2() +weaver.general.GCONST.getContextPath()+ "/weaver/weaver.file.FileDownload?fileid=" + DocDownloadCheckUtil.checkPermission(imageFileId+"",user) + getSeparator2();
|
|
|
}
|
|
|
} else {
|
|
|
remark_check = "" + Util.getSeparator();
|
|
|
if (viewdescall == 1 || vdcomments == 1) {
|
|
|
remark = "" + Util.getSeparator();
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
//未使用表单签章,则 获取手写输入签字意见内容
|
|
|
remark_check = param2String(params, "remark");
|
|
|
remark_check = wfLinkInfo.removeRemarkSource(remark_check);
|
|
|
if (viewdescall == 1 || vdcomments == 1)
|
|
|
remark = remark_db;
|
|
|
}
|
|
|
}
|
|
|
remark = checkImage(remark);
|
|
|
remark = checkNetImg(remark);
|
|
|
|
|
|
|
|
|
String reamrk_others = "";
|
|
|
//相关文档
|
|
|
if ((viewdescall == 1 || vsigndoc == 1) && !signdocids.trim().equals("")) {
|
|
|
String tempname = getSignDocs(signdocids, languageid);
|
|
|
if (!"".equals(tempname))
|
|
|
reamrk_others += "<br>" + tempname;
|
|
|
}
|
|
|
//相关流程
|
|
|
if ((viewdescall == 1 || vsignworkflow == 1) && !signworkflowids.trim().equals("")) {
|
|
|
String tempname = getSignFlows(signworkflowids, languageid);
|
|
|
if (!"".equals(tempname))
|
|
|
reamrk_others += "<br>" + tempname;
|
|
|
}
|
|
|
//相关附件
|
|
|
if ((viewdescall == 1 || vsignupload == 1) && !annexdocids.trim().equals("")) {
|
|
|
String tempname = getSignUploads(annexdocids, languageid);
|
|
|
if (!"".equals(tempname))
|
|
|
reamrk_others += "<br>" + tempname;
|
|
|
}
|
|
|
username = "";
|
|
|
departmentname = "";
|
|
|
if (!logtype.equals("t")) {
|
|
|
remark = appendSomeContent(remark, appHandWrittenSignID, appSpeechAttahmentID, ismode, remarkLocation,"");
|
|
|
remark = checkRemark(remark, ismode);
|
|
|
}
|
|
|
//判断是否为空意见
|
|
|
boolean isnull_remark = false;
|
|
|
remark_check = appendSomeContent(remark_check, appHandWrittenSignID, appSpeechAttahmentID, ismode, remarkLocation,"");
|
|
|
remark_check = Util.encodeJS(toExcel(dropScript(remark_check)));
|
|
|
if ("".equals(remark_check))
|
|
|
isnull_remark = true;
|
|
|
|
|
|
//不显示空的意见
|
|
|
if (stnull == 1 && isnull_remark) continue;
|
|
|
|
|
|
//读取配置信息,判断当前是否显示全部签字意见,还是显示最一次提交签字意见。
|
|
|
if (preoperators.indexOf(operator + "_" + nodeid_temp) == -1) {
|
|
|
if (!NodeRemark.trim().equals("")) {
|
|
|
//Remark+="<br>";
|
|
|
if (orderby.equals("asc")) {
|
|
|
NodeRemark = "<br>" + NodeRemark;
|
|
|
} else {
|
|
|
NodeRemark += "<br>";
|
|
|
}
|
|
|
}
|
|
|
String userimg = "";
|
|
|
String agentstr = "";
|
|
|
|
|
|
if (operatortype == 0) {
|
|
|
String signatureImg = SecondAuthBiz.getQYSSignatureImg(logId + "", operator + "", user, logIdMap, qysSignInfoMap);
|
|
|
if (!"".equals(signatureImg)) { //优先显示契约锁数据保护或者认证时选择的章
|
|
|
userimg = signatureImg;
|
|
|
} else {
|
|
|
if (showimg == 1) {//个性化签章
|
|
|
if (viewdescall == 1 || vdoperator == 1) {
|
|
|
userimg = getNameImg(operator, ismode);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if ((viewdescall == 1 || vdoperator == 1))
|
|
|
username = resourcecominfo.getResourcename("" + operator);
|
|
|
if (viewdescall == 1 || vddeptname == 1)
|
|
|
departmentname = orgShowBiz.getDepartmentShow("workflow","" + operatorDept);
|
|
|
|
|
|
//被代理
|
|
|
if (agenttype == 2 && agentorbyagentid > 0) {
|
|
|
String tdepartmentname = orgShowBiz.getDepartmentShow("workflow", resourcecominfo.getDepartmentID("" + agentorbyagentid));
|
|
|
if (viewdescall == 1 || (vddeptname == 1 && vdoperator == 1)) {
|
|
|
if (!"".equals(tdepartmentname)) {
|
|
|
agentstr = "(" + SystemEnv.getHtmlLabelName(26241, languageid) + " " + tdepartmentname + "/" + resourcecominfo.getResourcename("" + agentorbyagentid) + ")";
|
|
|
} else {
|
|
|
agentstr = "(" + SystemEnv.getHtmlLabelName(26241, languageid) + " " + resourcecominfo.getResourcename("" + agentorbyagentid) + SystemEnv.getHtmlLabelName(24214, languageid) + ")";
|
|
|
}
|
|
|
} else {
|
|
|
if (vddeptname == 1 && !"".equals(tdepartmentname))
|
|
|
agentstr = "(" + SystemEnv.getHtmlLabelName(26241, languageid) + " " + tdepartmentname + ")";
|
|
|
if (vdoperator == 1)
|
|
|
agentstr = "(" + SystemEnv.getHtmlLabelName(26241, languageid) + " " + resourcecominfo.getResourcename("" + agentorbyagentid) + ")";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//}
|
|
|
}
|
|
|
if (operatortype == 1) {
|
|
|
if (viewdescall == 1 || vdoperator == 1)
|
|
|
username = crmcominfo.getCustomerInfoname("" + operator);
|
|
|
}
|
|
|
if (operatortype == 2) {
|
|
|
if (viewdescall == 1 || vdoperator == 1)
|
|
|
username = robotNodeServiceBiz.getRobotNodeSet(nodeid_temp).getOperatorName();
|
|
|
}
|
|
|
|
|
|
if (!"".equals(agentstr))
|
|
|
agentstr = " " + agentstr;
|
|
|
|
|
|
if (viewdescall == 1 || (vddeptname == 1 && vdoperator == 1)) {//操作人、部门都显示
|
|
|
if ("".equals(userimg)) {//没签章
|
|
|
if (!"".equals(departmentname))
|
|
|
username = departmentname + "/" + username + agentstr;
|
|
|
else
|
|
|
username = departmentname + username + agentstr;
|
|
|
} else {
|
|
|
if (!"".equals(userimg))//模版模式下签章
|
|
|
username = departmentname + agentstr;
|
|
|
}
|
|
|
} else {
|
|
|
if (vddeptname == 1) {//只显示部门
|
|
|
if ("".equals(userimg)) {//没签章
|
|
|
username = departmentname + agentstr;
|
|
|
} else {
|
|
|
if (!"".equals(userimg))//模版模式下签章
|
|
|
username = departmentname + agentstr;
|
|
|
}
|
|
|
}
|
|
|
if (vdoperator == 1) {//只显示操作人
|
|
|
if ("".equals(userimg)) {//没签章
|
|
|
username += agentstr;
|
|
|
} else {
|
|
|
if (!"".equals(userimg))//模版模式下签章
|
|
|
username = agentstr;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
if (viewdescall == 1 || vddate == 1) if (username.equals(""))
|
|
|
username += param2String(params, "operatedate");
|
|
|
else username += " " + param2String(params, "operatedate");
|
|
|
if (viewdescall == 1 || vdtime == 1) if (username.equals(""))
|
|
|
username += param2String(params, "operatetime");
|
|
|
else username += " " + param2String(params, "operatetime");
|
|
|
if (showtype == 0)
|
|
|
preoperators.add(operator + "_" + nodeid_temp);
|
|
|
|
|
|
if (viewdescall == 1 || vdcomments == 1 || !"".equals(reamrk_others.trim())) {
|
|
|
remark += reamrk_others;
|
|
|
String spt = "";
|
|
|
if (ismode == 0) {
|
|
|
if (!"".equals(userimg))
|
|
|
spt = getSeparator2();
|
|
|
}
|
|
|
if (remark != null && (remark.endsWith("</p><script>initFlashVideo();</script>") || remark.endsWith("</p>"))) {
|
|
|
username = remark + spt + username;
|
|
|
} else {
|
|
|
if (remark.endsWith("<br>"))
|
|
|
username = remark + spt + username;
|
|
|
else
|
|
|
username = remark + spt + "<br>" + username;
|
|
|
}
|
|
|
} else {
|
|
|
if (!"".equals(userimg))
|
|
|
username = getSeparator2() + username;
|
|
|
}
|
|
|
|
|
|
if (!userimg.equals("")) {
|
|
|
username += Util.getSeparator() + userimg;
|
|
|
}
|
|
|
|
|
|
if(viewdescall == 1 ||vdaction==1){
|
|
|
RequestLogOperateName requestLogOperateName = new RequestLogOperateName();
|
|
|
String operateName = requestLogOperateName.getOperateName(workflowid + "", Requestid + "", nodeid_temp + "", logtype, operator + "", languageid);
|
|
|
//zzw
|
|
|
username+=" "+operateName;
|
|
|
}
|
|
|
|
|
|
if (orderby.equals("asc")) {
|
|
|
NodeRemark = username + NodeRemark;
|
|
|
NodeRemark = "<br>" + NodeRemark;
|
|
|
} else {
|
|
|
NodeRemark += username;
|
|
|
NodeRemark += "<br>";
|
|
|
}
|
|
|
NodeRemark += getNodeSeparator();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (orderby.equals("asc")) {
|
|
|
if (NodeRemark.startsWith("<br>")) {
|
|
|
NodeRemark = NodeRemark.substring("<br>".length());
|
|
|
}
|
|
|
} else {
|
|
|
String tempEndStr = "<br>" + getNodeSeparator();
|
|
|
if (NodeRemark.endsWith(tempEndStr)) {
|
|
|
NodeRemark = NodeRemark.substring(0, NodeRemark.length() - tempEndStr.length());
|
|
|
}
|
|
|
}
|
|
|
NodeRemark = Util.StringReplace(NodeRemark, "<br>", "<br>");
|
|
|
NodeRemark = NodeRemark.replaceAll(getSeparator2() + "<br>", getSeparator2());
|
|
|
NodeRemark = NodeRemark.replaceAll("<br>" + getSeparator2(), getSeparator2());
|
|
|
NodeRemark = NodeRemark.replaceAll(getSeparator2() + "<br>", getSeparator2());
|
|
|
NodeRemark = NodeRemark.replaceAll("<br>" + Util.getSeparator(), getSeparator2());
|
|
|
NodeRemark = NodeRemark.replaceAll("<br>" + getNodeSeparator() + "<br>", "<br><br>");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//处理完成后还原,下一个重新判断
|
|
|
this.needHide = false;
|
|
|
|
|
|
return NodeRemark;
|
|
|
}
|
|
|
|
|
|
|
|
|
private String getAllFreeNodeIds(){
|
|
|
RecordSet rs = new RecordSet();
|
|
|
rs.executeQuery("select id from workflow_nodebase where IsFreeNode = 1 and requestid = " + Requestid);
|
|
|
List<Integer> freeNodeIds = new ArrayList <>();
|
|
|
while (rs.next()) {
|
|
|
freeNodeIds.add(rs.getInt("id"));
|
|
|
}
|
|
|
freeNodeIds.addAll(FreeNodeBiz.getRequestAllFreeNodeIds(Requestid));
|
|
|
String nodeids = "";
|
|
|
if(freeNodeIds.size() > 0) {
|
|
|
nodeids = CollectionUtil.list2String(freeNodeIds,",");
|
|
|
}
|
|
|
if("".equals(nodeids)) nodeids = "-1";
|
|
|
return nodeids;
|
|
|
}
|
|
|
|
|
|
private String param2String(Map<String,String> params,String key){
|
|
|
return Util.null2String(params.get(key.toLowerCase()));
|
|
|
}
|
|
|
|
|
|
private int param2Integer(Map<String,String> params,String key){
|
|
|
return Util.getIntValue(Util.null2String(params.get(key.toLowerCase())),0);
|
|
|
}
|
|
|
|
|
|
|
|
|
private Map<String,String> getIsRemark(int requestid,int nodeid,int operator){
|
|
|
String preisremark = "";
|
|
|
int takisremark= 1;
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
RecordSet recordset = new RecordSet();
|
|
|
recordset.executeQuery("select preisremark,takisremark from workflow_currentoperator where userid="+operator+" and nodeid="+nodeid+" and isremark=2 and (preisremark=9 or preisremark=1) and requestid="+requestid+" order by preisremark");
|
|
|
if(recordset.next()){
|
|
|
preisremark = Util.null2String(recordset.getString("preisremark"));
|
|
|
takisremark = Util.getIntValue(recordset.getString("takisremark"));
|
|
|
}
|
|
|
map.put("preisremark",preisremark);
|
|
|
map.put("takisremark",takisremark+"");
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param backfields
|
|
|
* @param fromSql
|
|
|
* @param sqlWhere
|
|
|
* @param ORwhere
|
|
|
* @param orderBy
|
|
|
* @param workflowid
|
|
|
* @param logTypeSet
|
|
|
* @return
|
|
|
*/
|
|
|
private List<Map<String,String>> getRemarkList(String backfields,String fromSql,String sqlWhere,String ORwhere,String orderBy,int workflowid,int requestid,Set<String> logTypeSet,Set<String> logIdSet,boolean recursive){
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String sql = "select " + backfields + " from " + fromSql + " " + sqlWhere;
|
|
|
// System.out.println(requestid+"--getRemarkList sql--"+sql);
|
|
|
if(layoutNodeid == -1 || layoutNodeid == -2 || layoutNodeid == -3 || layoutNodeid == -9999 || layoutNodeid == RequestConstant.ALL_NODE_SIGN_MARK){//签字意见范围控制
|
|
|
rs.writeLog("节点签字意见设置范围:viewNodeidScope:"+viewNodeidScope+";layoutNodeid:"+layoutNodeid + ";sql:"+sql);
|
|
|
rs.executeQuery("select viewnodeids from workflow_flownode where nodeid = ?",viewNodeidScope);
|
|
|
if(rs.next()){
|
|
|
List<String > viewnodeidsList = Util.TokenizerString(Util.null2String(rs.getString("viewnodeids")),",");
|
|
|
FreeNodeBiz.loadViewLogFreeNodeIds(requestid, viewnodeidsList);
|
|
|
String viewnodeids = "";
|
|
|
for(String nodeid : viewnodeidsList){
|
|
|
viewnodeids += nodeid + ",";
|
|
|
}
|
|
|
if(!"".equals(viewnodeids)){
|
|
|
viewnodeids = viewnodeids.substring(0,viewnodeids.length()-1);
|
|
|
}
|
|
|
sql += ("".equals(viewnodeids) || "-1".equals(viewnodeids)) ? "" : (" and (t1.nodeid in("+viewnodeids+")) ");
|
|
|
rs.writeLog("节点签字意见设置范围:viewnodeids:"+viewnodeids+";sql:"+sql);
|
|
|
}
|
|
|
}
|
|
|
if (!ORwhere.equals(""))
|
|
|
sql += " and (" + ORwhere + ") ";
|
|
|
|
|
|
sql += orderBy;
|
|
|
List<Map<String,String>> dataArr = new ArrayList<>();
|
|
|
rs.execute(sql);
|
|
|
Map<String, String> signInputMap = ShowType.getSignInputMap();
|
|
|
RecordSet rs1 = new RecordSet();
|
|
|
boolean isNew = true;
|
|
|
DateTransformer dft = new DateTransformer();
|
|
|
UnifiedConversionInterface uci = new UnifiedConversionInterface();
|
|
|
while (rs.next()) {
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
String[] columnNames = rs.getColumnName();
|
|
|
String operatedate = Util.null2String(rs.getString("operatedate"));
|
|
|
String operatetime = Util.null2String(rs.getString("operatetime"));
|
|
|
if(uci.getTimeZoneStatus()) {
|
|
|
//开启多时区
|
|
|
String[] tempoperatetime = dft.getLocaleDateAndTime(operatedate,operatetime);
|
|
|
operatedate = tempoperatetime[0];
|
|
|
operatetime = tempoperatetime[1];
|
|
|
}
|
|
|
for(String columnName : columnNames){
|
|
|
if("operatedate".equals(columnName.toLowerCase())){
|
|
|
map.put(columnName.toLowerCase(),operatedate);
|
|
|
}else if("operatetime".equals(columnName.toLowerCase())){
|
|
|
map.put(columnName.toLowerCase(),operatetime);
|
|
|
}else{
|
|
|
map.put(columnName.toLowerCase(),rs.getString(columnName));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
String logId = Util.null2String(rs.getString("logId"));
|
|
|
String uuid = Util.null2String(rs.getString("uuid"));
|
|
|
String logtype = Util.null2String(rs.getString("logtype"));
|
|
|
|
|
|
|
|
|
|
|
|
String belongLogtype = signInputMap.get(logtype);
|
|
|
|
|
|
|
|
|
boolean flag = logTypeSet.size() > 0 && (!logTypeSet.contains(logtype) || (logTypeSet.contains(logtype) && recursive && signInputMap.values().contains(logtype)));
|
|
|
|
|
|
if(!flag){
|
|
|
if(logIdSet != null && logIdSet.size() > 0){
|
|
|
if(logIdSet.contains(logId)){
|
|
|
flag = false;
|
|
|
} else {
|
|
|
flag = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
if("9".equals(logtype) && flag){
|
|
|
String s = "select distinct a.uuid,b.userid,b.operatedate,b.operatetime from workflow_Forward a,workflow_currentoperator b where a.BeForwardid = b.id and b.workflowid = "+workflowid+" and b.requestid = "+requestid+" and b.operatedate = '"+operatedate+"' and b.operatetime = '"+operatetime+"'";
|
|
|
rs1.executeQuery(s);
|
|
|
if(!rs1.next()){
|
|
|
flag = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(!flag){
|
|
|
dataArr.add(map);
|
|
|
}
|
|
|
|
|
|
|
|
|
if(belongLogtype != null && logTypeSet.contains(belongLogtype) && !"".equals(uuid) && recursive){
|
|
|
String newbackfields = "t1.*";
|
|
|
String newfromSql = fromSql;
|
|
|
String newsqlWhere = "";
|
|
|
|
|
|
if(isNew){
|
|
|
if("9".equals(belongLogtype)){
|
|
|
newfromSql += " inner join (select distinct a.uuid,b.userid,b.operatedate,b.operatetime from workflow_Forward a,workflow_currentoperator b where a.BeForwardid = b.id and b.workflowid = "+workflowid+" and b.requestid = "+requestid+" and b.receivedate = '"+operatedate+"' and b.receivetime = '"+operatetime+"') tt3 on tt3.userid = t1.operator and t1.operatedate = tt3.operatedate and t1.operatetime = tt3.operatetime ";
|
|
|
} else if("y".equals(belongLogtype)){
|
|
|
newfromSql += " inner join workflow_chuanyue tt3 on tt3.userid = t1.operator " +
|
|
|
" inner join workflow_currentoperator tt4 on tt3.userid = tt4.userid and t1.operatedate = tt4.operatedate and t1.operatetime = tt4.operatetime " +
|
|
|
" and t1.requestid = tt4.requestid and t1.nodeid = tt4.nodeid and tt4.receivedate = '"+operatedate+"' and tt4.receivetime = '"+operatetime+"'";
|
|
|
}
|
|
|
} else {
|
|
|
if("9".equals(belongLogtype)){
|
|
|
newfromSql += " inner join (select distinct a.uuid,b.userid from workflow_Forward a,workflow_currentoperator b where a.BeForwardid = b.id and b.workflowid = "+workflowid+" and b.requestid = "+requestid+") tt3 on tt3.userid = t1.operator ";
|
|
|
} else if("y".equals(belongLogtype)){
|
|
|
newfromSql += " inner join workflow_chuanyue tt3 on tt3.userid = t1.operator";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
newsqlWhere += sqlWhere;
|
|
|
newsqlWhere += " and tt3.uuid = '" + uuid + "'";
|
|
|
newsqlWhere += " and (t1.operatedate >= '" + operatedate + "' or (t1.operatedate = '" + operatedate + "' and t1.operatetime >= '" + operatetime + "'))";
|
|
|
String newORwhere = " 1=1 and logtype = '"+belongLogtype+"' ";
|
|
|
dataArr.addAll(getRemarkList(newbackfields,newfromSql,newsqlWhere,newORwhere,orderBy,workflowid,requestid,logTypeSet,logIdSet,false));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return dataArr;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 生成模版内签字意见
|
|
|
*
|
|
|
* @param list
|
|
|
* @param workflowid
|
|
|
* @param nodeid
|
|
|
* @param remarkcolumn 显示列数
|
|
|
* @param language
|
|
|
* @return
|
|
|
*/
|
|
|
private String calcRemark(List<RemarkInfoDTO> list, int workflowid, int nodeid, int remarkcolumn, int language, List<RemarkDisplayDTO> displayList, int selectformat, String showdesc, String signShowDesc) {
|
|
|
// 保存showDesc 以便当使用个性签章时 showDesc值变为signShowDesc ,但循环判断时需要先把showDesc还原
|
|
|
String showDescBak = showdesc;
|
|
|
if("".equals(lastTableContent) && (list == null || list.size() == 0))
|
|
|
return ""; //节点无意见的不返回table布局,避免占空间
|
|
|
StringBuffer result = new StringBuffer();
|
|
|
|
|
|
isTableShow = false;
|
|
|
String contentBefore = "";
|
|
|
String contentAfter = "";
|
|
|
|
|
|
//存在表头表尾标识,按照表格显示
|
|
|
if(selectformat == 1 && showdesc != null && showdesc.indexOf("$viewdesc_table_start$") > -1 && showdesc.indexOf("$viewdesc_table_end$") > -1) {
|
|
|
try {
|
|
|
String json = JSON.parseObject(showdesc).getString("json");
|
|
|
List<NodeFormDesc> nodeFormDescList = JSON.parseArray(json, NodeFormDesc.class);
|
|
|
if (nodeFormDescList.size() > 0) {
|
|
|
NodeFormDesc nodeFormDesc = nodeFormDescList.get(0);
|
|
|
contentBefore = Util.null2String(nodeFormDesc.getTableHtml(0, user));
|
|
|
contentAfter = nodeFormDesc.getTableHtml(2, user);
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if(!"".equals(contentBefore.trim()) && contentBefore.toLowerCase().indexOf("<table") > -1) {
|
|
|
isTableShow = true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//签章意见是否设置为表格显示
|
|
|
boolean isSignTableShow = false;
|
|
|
if(selectformat == 1 && signShowDesc != null && signShowDesc.indexOf("$viewdesc_table_start$") > -1 && signShowDesc.indexOf("$viewdesc_table_end$") > -1) {
|
|
|
String signShowContentBefore = "";
|
|
|
try {
|
|
|
String json = JSON.parseObject(signShowDesc).getString("json");
|
|
|
List<NodeFormDesc> nodeFormDescList = JSON.parseArray(json, NodeFormDesc.class);
|
|
|
if (nodeFormDescList.size() > 0) {
|
|
|
NodeFormDesc nodeFormDesc = nodeFormDescList.get(0);
|
|
|
signShowContentBefore = nodeFormDesc.getTableHtml(0, user);
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if(!"".equals(signShowContentBefore.trim())) {
|
|
|
isSignTableShow = true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//表格形式显示, 不分栏
|
|
|
if(isTableShow) {
|
|
|
remarkcolumn = 1;
|
|
|
}
|
|
|
|
|
|
List<List<String>> columnList = new ArrayList<List<String>>(remarkcolumn);//用于存储每一列的签字意见
|
|
|
for (int i = 0; i < remarkcolumn; i++) {
|
|
|
List<String> column = new ArrayList<String>();
|
|
|
columnList.add(column);
|
|
|
}
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
if(showdesc!=null && showdesc.equals(signShowDesc)){
|
|
|
showdesc = showDescBak; // 恢复原本的默认格式
|
|
|
}
|
|
|
//每一条意见
|
|
|
RemarkInfoDTO dto = list.get(i);
|
|
|
|
|
|
//2023.02.15查询上级部门ID
|
|
|
String deptSql = "select supdepid from hrmdepartment where id = '"+dto.getDeptid()+"'";
|
|
|
RecordSet rsd = new RecordSet();
|
|
|
rsd.executeQuery(deptSql);
|
|
|
String supdepId="";
|
|
|
if(rsd.next()){
|
|
|
supdepId = rsd.getString("supdepid");
|
|
|
}
|
|
|
|
|
|
if ("0".equals(supdepId)){
|
|
|
supdepId=String.valueOf(dto.getDeptid());
|
|
|
}
|
|
|
log.info("【查询部门supdepId========】:"+supdepId);
|
|
|
String temp_remark = "";
|
|
|
if (selectformat != 1) {
|
|
|
//安装默认格式读取
|
|
|
temp_remark = getRemarkBySetting(dto, displayList, language);
|
|
|
} else {
|
|
|
//有签章,且不是表格显示,取签章设置
|
|
|
if (!"".equals(dto.getNameImg()) && !isTableShow && !isSignTableShow) {
|
|
|
showdesc = signShowDesc;
|
|
|
}
|
|
|
temp_remark = ShowType.doReplaceDesc(dto, showdesc, user, i+1);
|
|
|
}
|
|
|
|
|
|
//qc1679821 将部门id加到html中 用于后面处理分类
|
|
|
temp_remark += "<span style='display:none' name='$remark_dept_id$'>"+supdepId+"</span>";
|
|
|
// temp_remark += "<span style='display:none' name='$remark_dept_id$'>"+dto.getDeptid()+"</span>";
|
|
|
int columlIndex = i % remarkcolumn;
|
|
|
columnList.get(columlIndex).add(temp_remark);//把数据加入指定列
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int remarkSize = list.size();
|
|
|
if (remarkSize == 0)
|
|
|
remarkSize = 1;
|
|
|
int width_percent = 0;
|
|
|
if (remarkSize < remarkcolumn) {//如果意见数量小于列数,则按照实际意见数平分列宽
|
|
|
width_percent = 100 / remarkSize;
|
|
|
remarkcolumn = remarkSize;
|
|
|
} else
|
|
|
width_percent = 100 / remarkcolumn;
|
|
|
|
|
|
//form_sign_cellbr 2: 签字意见不换行显示
|
|
|
boolean needBr = !"2".equals(new WorkflowConfigComInfo().getValue("form_sign_cellbr"));
|
|
|
|
|
|
//按照表格形式显示
|
|
|
if (isTableShow) {
|
|
|
result.append("<div id='formremark_" + nodeid + "' class='wf-req-cell-remark-div' width='100%'>");
|
|
|
for (int i = 0; i < remarkcolumn; i++) {
|
|
|
//多字段同一个单元格显示, 将上一个字段的内容拼接过来
|
|
|
this.tableContent = lastTableContent + getColumnString(columnList.get(i), false);
|
|
|
result.append(contentBefore).append(tableContent).append(contentAfter);
|
|
|
}
|
|
|
result.append("</div>");
|
|
|
} else {
|
|
|
//普通模式显示
|
|
|
result.append("<table id='formremark_" + nodeid + "' class='wf-req-cell-remark' width='100%' style='table-layout:fixed;'><tr>");
|
|
|
for (int i = 0; i < remarkcolumn; i++) {
|
|
|
|
|
|
//qc1679821 remarkHtml为该节点所有签字意见
|
|
|
String remarkHtml = "";
|
|
|
if(needHide){
|
|
|
remarkHtml = getColumnString1(columnList.get(i), needBr);//处理成需要折叠显示的格式
|
|
|
}else{//非折叠走标准逻辑
|
|
|
remarkHtml = getColumnString(columnList.get(i), needBr);
|
|
|
}
|
|
|
|
|
|
result.append("<td needline='true' style='vertical-align:top;word-break: break-all;' width='" + width_percent + "%'>").append(remarkHtml).append("</td>");
|
|
|
if(remarkcolumn - i >= 2){//意见分栏中间留出一部分空白区域
|
|
|
result.append("<td style=\"width:23px\"></td>");
|
|
|
}
|
|
|
}
|
|
|
result.append("</tr></table>");
|
|
|
}
|
|
|
return result.toString();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 生成每一列的签字意见
|
|
|
*
|
|
|
* @param list
|
|
|
* @return
|
|
|
*/
|
|
|
private String getColumnString(List<String> list) {
|
|
|
return this.getColumnString(list, true);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 生成每一列的签字意见
|
|
|
*
|
|
|
* @param list
|
|
|
* @return
|
|
|
*/
|
|
|
private String getColumnString(List<String> list, boolean needBr) {
|
|
|
String result = "";
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
String s = list.get(i);
|
|
|
if (i > 0 && needBr)
|
|
|
result += hr;
|
|
|
result += s;
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据配置格式生成签字意见
|
|
|
*
|
|
|
* @param remarkInfoDTO
|
|
|
* @param displayList
|
|
|
* @return
|
|
|
*/
|
|
|
public String getRemarkBySetting(RemarkInfoDTO remarkInfoDTO, List<RemarkDisplayDTO> displayList, int language) {
|
|
|
String result = "";
|
|
|
int enter = 0;
|
|
|
int i = 0;
|
|
|
int lastShowtype = -1;
|
|
|
int isShowTemp = 0;
|
|
|
|
|
|
//是否显示部门
|
|
|
boolean isshowDepartment = false;
|
|
|
boolean isshowOperator = false;
|
|
|
int departMentIndex = -1;
|
|
|
int operatorIndex = -1;
|
|
|
int index = 0;
|
|
|
for (RemarkDisplayDTO displayDTO : displayList) {
|
|
|
if (displayDTO.getShowtype() == 6) {//部门
|
|
|
if (displayDTO.getIsshow() == 1) {
|
|
|
isshowDepartment = true;
|
|
|
departMentIndex = index;
|
|
|
}
|
|
|
} else if (displayDTO.getShowtype() == 7) {
|
|
|
if (displayDTO.getIsshow() == 1) {
|
|
|
isshowOperator = true;
|
|
|
operatorIndex = index;
|
|
|
}
|
|
|
}
|
|
|
//有签章
|
|
|
if (!"".equals(remarkInfoDTO.getNameImg())) {
|
|
|
|
|
|
if (displayDTO.getShowtype() == 0) {
|
|
|
isShowTemp = displayDTO.getIsshow();
|
|
|
displayDTO.setIsshow(0);
|
|
|
}
|
|
|
//操作人应该在操作部门前面
|
|
|
if (displayDTO.getShowtype() == 7 && isshowDepartment) {
|
|
|
RemarkDisplayDTO departmentDTO = displayList.get(departMentIndex);
|
|
|
if (departmentDTO != null && departmentDTO.getShowtype() == 6 && departmentDTO.getIsshow() == 1) {
|
|
|
RemarkDisplayDTO temp = departmentDTO;
|
|
|
displayList.set(departMentIndex, displayDTO);
|
|
|
displayList.set(index, temp);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}else{ // 非签章
|
|
|
// 部门在操作人前面
|
|
|
if(displayDTO.getShowtype() == 6 && isshowDepartment && operatorIndex > -1){
|
|
|
RemarkDisplayDTO operatorDTO = displayList.get(operatorIndex);
|
|
|
if(operatorDTO!=null && operatorDTO.getShowtype() == 7 && operatorDTO.getIsshow() == 1){
|
|
|
RemarkDisplayDTO temp = operatorDTO;
|
|
|
displayList.set(index,temp);
|
|
|
displayList.set(operatorIndex,displayDTO);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
index++;
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
//拼装签字意见信息
|
|
|
for (RemarkDisplayDTO displayDTO : displayList) {
|
|
|
//显示项内容
|
|
|
int showtype = displayDTO.getShowtype();
|
|
|
|
|
|
if (displayDTO.getIsshow() != 1)
|
|
|
continue;
|
|
|
|
|
|
|
|
|
String showText = "";
|
|
|
if (showtype == 0) {//文本内容
|
|
|
if (!isshowDepartment || !isshowOperator) {
|
|
|
continue;
|
|
|
}
|
|
|
showText = displayDTO.getTextvalue();
|
|
|
if (showText == null || "".equals(showText))
|
|
|
showText = " ";
|
|
|
showText = showText.replaceAll(" ", " ");
|
|
|
} else if (showtype == 1) {//处理意见
|
|
|
showText = remarkInfoDTO.getRemark();
|
|
|
} else if (showtype == 2) {//意见来源
|
|
|
showText = remarkInfoDTO.getRemarkSrc();
|
|
|
} else if (showtype == 3) {//相关文档
|
|
|
showText = remarkInfoDTO.getSignDocs();
|
|
|
} else if (showtype == 4) {//相关流程
|
|
|
showText = remarkInfoDTO.getSignFlows();
|
|
|
} else if (showtype == 5) {//相关附件
|
|
|
showText = remarkInfoDTO.getSignUploads();
|
|
|
} else if (showtype == 6) {//操作部门
|
|
|
showText = remarkInfoDTO.getDepartment();
|
|
|
} else if (showtype == 7) {//操作人
|
|
|
//有签章需要回车
|
|
|
if (!"".equals(remarkInfoDTO.getNameImg())) {
|
|
|
displayDTO.setEnter(1);
|
|
|
}else{
|
|
|
displayDTO.setEnter(0);
|
|
|
}
|
|
|
showText = remarkInfoDTO.getUsername();
|
|
|
String agentUser = Util.null2String(remarkInfoDTO.getAgentUser());
|
|
|
if (!"".equals(agentUser)) { //拼装代理信息
|
|
|
showText += "(" + SystemEnv.getHtmlLabelName(26241, language) + " ";
|
|
|
String agentDepartment = Util.null2String(remarkInfoDTO.getAgentDepartment());
|
|
|
if (isshowDepartment && !"".equals(agentDepartment)) {
|
|
|
showText += agentDepartment + "/";
|
|
|
}
|
|
|
showText += agentUser + ")";
|
|
|
}
|
|
|
} else if (showtype == 8) {//操作日期
|
|
|
showText = remarkInfoDTO.getOperatedate();
|
|
|
} else if (showtype == 9) {//操作时间
|
|
|
showText = remarkInfoDTO.getOperatetime();
|
|
|
} else if (showtype == 10) {//操作
|
|
|
showText = remarkInfoDTO.getOperateName();
|
|
|
} else if (showtype == 11) {//位置
|
|
|
showText = remarkInfoDTO.getPosition();
|
|
|
} else if(showtype == 12) {//分部
|
|
|
showText = remarkInfoDTO.getSubcompany();
|
|
|
} else if (showtype == 13) {//岗位
|
|
|
showText = remarkInfoDTO.getJobTitle();
|
|
|
} else if (showtype == 16) {
|
|
|
showText = remarkInfoDTO.getOperatorNodeName();
|
|
|
}
|
|
|
|
|
|
if (showText == null || "".equals(showText))
|
|
|
continue;
|
|
|
|
|
|
if (i == 0 || enter == 1) {
|
|
|
if (displayDTO.getAlign() == 0)
|
|
|
//text-align:left;
|
|
|
result += "<div style='width:100%;'>";
|
|
|
else
|
|
|
//text-align:right;
|
|
|
result += "<div style='width:100%;'>";
|
|
|
}
|
|
|
|
|
|
if (showtype == 0) {
|
|
|
if (i != 0 && enter != 1 && lastShowtype != 0)
|
|
|
result = result.substring(0, result.length() - 1); //如果是自定义文本,则去掉默认增加的空格
|
|
|
result += showText;
|
|
|
} else
|
|
|
result += showText + " ";
|
|
|
|
|
|
enter = displayDTO.getEnter();
|
|
|
if (enter == 1)
|
|
|
result += "</div>";
|
|
|
|
|
|
i++;
|
|
|
lastShowtype = showtype;
|
|
|
}
|
|
|
|
|
|
if (i > 0)
|
|
|
result += "</div>";
|
|
|
// 还原有签章格式 showtype==0 isShow改为原本的isshow的值
|
|
|
for (RemarkDisplayDTO displayDTO : displayList){
|
|
|
if(displayDTO.getShowtype() == 0 && displayDTO.getIsshow() == 0){
|
|
|
if(0 !=isShowTemp ){
|
|
|
displayDTO.setIsshow(isShowTemp);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
String abc = " ";
|
|
|
String s = abc.replaceAll(" ", " ");
|
|
|
System.out.println(s);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 给一个list取反
|
|
|
*
|
|
|
* @param in
|
|
|
* @return
|
|
|
*/
|
|
|
public List reverseList(List in) {
|
|
|
List out = new ArrayList();
|
|
|
int size = in.size();
|
|
|
if (size > 0) {
|
|
|
for (int i = size - 1; i >= 0; i--) {
|
|
|
out.add(in.get(i));
|
|
|
}
|
|
|
}
|
|
|
return out;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取个性签章图片路径
|
|
|
*
|
|
|
* @param userid
|
|
|
* @param ismode
|
|
|
* @return
|
|
|
*/
|
|
|
public String getNameImg(int userid, int ismode) {
|
|
|
String filepath = "";
|
|
|
RecordSet recordSet = new RecordSet();
|
|
|
recordSet.executeSql("select * from DocSignature where hrmresid=" + userid + " and sealType=1 order by case when isdefault is null then ' ' else isdefault end desc,markid ");
|
|
|
if (recordSet.next()) {
|
|
|
filepath = Util.null2String(recordSet.getString(1));
|
|
|
}
|
|
|
if (!filepath.equals("")) {
|
|
|
OdocFileUtil odocfileutil = new OdocFileUtil();
|
|
|
String imgheight = recordSet.getPropValue("WFSignatureImg", "imgheight");
|
|
|
if (ismode == 2) {
|
|
|
if (StringUtils.isEmpty(imgheight)){
|
|
|
filepath = "<img class=\"signatureImg\" draggable=\"false\" src=\"" +weaver.general.GCONST.getContextPath()+ "/weaver/weaver.file.ImgFileDownload?userid=" + userid + "&sealType=1\"></img>";
|
|
|
}else {
|
|
|
String useridrandom = odocfileutil.changeParamToBase64Str(userid+"");
|
|
|
filepath = "<img class=\"signatureImg\" draggable=\"false\" style=\"max-height:"+imgheight+"px;\" src=\"" +weaver.general.GCONST.getContextPath()+ "/weaver/weaver.file.ImgFileDownload?userid=" + useridrandom + "&sealType=1\"></img>";
|
|
|
}
|
|
|
} else {
|
|
|
String useridrandom = odocfileutil.changeParamToBase64Str(userid+"");
|
|
|
filepath = weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.ImgFileDownload?userid=" + useridrandom + "&sealType=1" + getSeparator2();
|
|
|
}
|
|
|
}
|
|
|
return filepath;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 处理remark
|
|
|
*
|
|
|
* @param remark
|
|
|
* @return
|
|
|
*/
|
|
|
private String checkRemark(String remark, int ismode) {
|
|
|
if (ismode == 2) {
|
|
|
try {
|
|
|
//Html模式下,要考虑去掉最后一个</p>
|
|
|
if (remark.indexOf("initFlashVideo") > -1 && remark.indexOf("</p>") > -1) {
|
|
|
int index_1 = remark.lastIndexOf("</p>");
|
|
|
remark = remark.substring(0, index_1) + remark.substring(index_1 + 4);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
remark = remark.replaceAll("\n", "");
|
|
|
remark = remark.replaceAll("<br/></p>", "</p>");
|
|
|
remark = remark.replaceAll("</p><p", "</span><br><span");//两个<p>换行的,加上<br>
|
|
|
remark = remark.replaceAll("<p>", "<span>");
|
|
|
remark = remark.replaceAll("<P>", "<span>");
|
|
|
remark = remark.replaceAll("<p", "<span");
|
|
|
remark = remark.replaceAll("<P", "<span");
|
|
|
remark = remark.replaceAll("</p>", "</span>");
|
|
|
remark = remark.replaceAll("</P>", "</span>");
|
|
|
remark = remark.replaceAll("\r\n", "");
|
|
|
remark = remark.replaceAll("name=\".*?\"", "");
|
|
|
remark = remark.replaceAll("id=\".*?\"", "");
|
|
|
remark = remark.replaceAll("<br/>", "");
|
|
|
remark = remark.replaceAll("<br><br><span _target='wfautoapprove' style='font-size:11px;color:#666;'>", "<br><span _target='wfautoapprove' style='font-size:11px;color:#666;'>");
|
|
|
|
|
|
return remark;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取相关文档
|
|
|
*
|
|
|
* @param docids
|
|
|
* @param languageid
|
|
|
* @return
|
|
|
*/
|
|
|
private String getSignDocs(String docids, int languageid) {
|
|
|
String tempname = "";
|
|
|
ArrayList templist = Util.TokenizerString(docids, ",");
|
|
|
for (int i = 0; i < templist.size(); i++) {
|
|
|
String _docid = (String) templist.get(i);
|
|
|
|
|
|
if (Util.getIntValue(_docid) <= 0) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
String tempdocname = docinf.getDocname(_docid);
|
|
|
|
|
|
if (0 == Isprint) {
|
|
|
tempdocname = "<a style=\"cursor:pointer\" onclick=\"addDocReadTag(" + _docid + ");openFullWindowHaveBar('/docs/docs/DocDsp.jsp?id=" + _docid + "&isrequest=1&requestid=" + Requestid + "')\">" + tempdocname + "</a>";
|
|
|
} else {
|
|
|
tempdocname = tempdocname;
|
|
|
}
|
|
|
if (tempdocname != null && !tempdocname.trim().equals("")) {
|
|
|
if (tempname.equals("")) {
|
|
|
tempname = tempdocname;
|
|
|
} else {
|
|
|
tempname += "," + tempdocname;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
tempname = tempname.trim();
|
|
|
if (!"".equals(tempname))
|
|
|
tempname = SystemEnv.getHtmlLabelName(857, languageid) + ":" + tempname;
|
|
|
return tempname;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取相关流程
|
|
|
*
|
|
|
* @param signworkflowids
|
|
|
* @param languageid
|
|
|
* @return
|
|
|
*/
|
|
|
private String getSignFlows(String signworkflowids, int languageid) {
|
|
|
ArrayList templist = Util.TokenizerString(signworkflowids, ",");
|
|
|
String tempname = "";
|
|
|
int tempnum = request == null ? 0 : Util.getIntValue(String.valueOf(request.getSession().getAttribute("slinkwfnum")));
|
|
|
for (int i = 0; i < templist.size(); i++) {
|
|
|
String temprequestname = wfrequestcominfo.getRequestName((String) templist.get(i));
|
|
|
//处理相关流程
|
|
|
tempnum++;
|
|
|
if (request != null)
|
|
|
request.getSession().setAttribute("resrequestid" + tempnum, "" + templist.get(i));
|
|
|
String temprequestnameL = "";
|
|
|
if (0 == Isprint)
|
|
|
temprequestnameL = "<a style=\"cursor:pointer\" onclick=\"openFullWindowHaveBar('/workflow/request/ViewRequestForwardSPA.jsp?isrequest=1&requestid=" + templist.get(i) + "&wflinkno=" + tempnum + "&desrequestid=" + remarkRequestid + "')\">" + temprequestname + "</a>";
|
|
|
else
|
|
|
temprequestnameL = temprequestname;
|
|
|
|
|
|
if (temprequestname != null && !temprequestname.trim().equals("")) {
|
|
|
if (tempname.equals("")) {
|
|
|
tempname = temprequestnameL;
|
|
|
} else {
|
|
|
tempname += "," + temprequestnameL;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (request != null) {
|
|
|
request.getSession().setAttribute("slinkwfnum", "" + tempnum);
|
|
|
request.getSession().setAttribute("haslinkworkflow", "1");
|
|
|
}
|
|
|
tempname = tempname.trim();
|
|
|
if (!"".equals(tempname))
|
|
|
tempname = SystemEnv.getHtmlLabelName(1044, languageid) + ":" + tempname;
|
|
|
return tempname;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取附件信息
|
|
|
*
|
|
|
* @param annexdocids
|
|
|
* @param languageid
|
|
|
* @return
|
|
|
*/
|
|
|
private String getSignUploads(String annexdocids, int languageid) {
|
|
|
ArrayList templist = Util.TokenizerString(annexdocids, ",");
|
|
|
String _tempdocids = ""; //记录已经添加的id
|
|
|
String tempname = "";
|
|
|
String _docid = "";
|
|
|
for (int i = 0; i < templist.size(); i++) {
|
|
|
_docid = (String) templist.get(i);
|
|
|
//过滤重复docid
|
|
|
if (("," + _tempdocids + ",").indexOf("," + _docid + ",") != -1) {
|
|
|
continue;
|
|
|
}
|
|
|
String tempdocname = docinf.getDocname((String) templist.get(i));
|
|
|
|
|
|
if (0 == Isprint) {
|
|
|
tempdocname = "<a style=\"cursor:pointer\" onclick=\"addDocReadTag(" + _docid + ");openFullWindowHaveBar('/docs/docs/DocDsp.jsp?id=" + _docid + "&isrequest=1&requestid=" + Requestid + "')\">" + tempdocname + "</a>";
|
|
|
} else {
|
|
|
tempdocname = tempdocname;
|
|
|
}
|
|
|
if (tempdocname != null && !tempdocname.trim().equals("")) {
|
|
|
if (tempname.equals("")) {
|
|
|
tempname = tempdocname;
|
|
|
} else {
|
|
|
tempname += "," + tempdocname;
|
|
|
}
|
|
|
}
|
|
|
_tempdocids += "," + _docid;
|
|
|
}
|
|
|
tempname = tempname.trim();
|
|
|
if (!"".equals(tempname))
|
|
|
tempname = SystemEnv.getHtmlLabelName(22194, languageid) + ":" + tempname;
|
|
|
|
|
|
return tempname;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询签字意见显示设置列表
|
|
|
*
|
|
|
* @param workflowid
|
|
|
* @param nodeid
|
|
|
* @return
|
|
|
*/
|
|
|
|
|
|
|
|
|
public List<RemarkDisplayDTO> getDisplayList(int workflowid, int nodeid, int language) {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
List<RemarkDisplayDTO> result = new ArrayList<RemarkDisplayDTO>();
|
|
|
rs.execute("select isfreenode,startnodeid from workflow_nodebase where id = " + nodeid);
|
|
|
int isprint = 0;
|
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
int isfreenode = rs.getInt(1);
|
|
|
if (isfreenode == 1) {
|
|
|
nodeid = rs.getInt(2);
|
|
|
}
|
|
|
|
|
|
String sql = "select * from workflow_remarkdisplay where workflowid = " + workflowid + " and nodeid = " + nodeid + " order by listorder asc";
|
|
|
RecordSetExtend recordSetExtend = new RecordSetExtend();
|
|
|
result = recordSetExtend.queryList(sql, RemarkDisplayDTO.class);
|
|
|
if (result.size() > 0) {
|
|
|
for (RemarkDisplayDTO dto : result) {
|
|
|
dto.setShowtypename(getShowtypeName(dto.getShowtype(), language));
|
|
|
}
|
|
|
} else {//如果之前没有设置,则返回初始设置
|
|
|
/* *****默认显示格式****
|
|
|
签字意见
|
|
|
意见来源
|
|
|
位置
|
|
|
相关文档
|
|
|
相关流程
|
|
|
相关附件
|
|
|
部门/姓名 日期 时间*/
|
|
|
for (int i = 1; i <= 10; i++) {
|
|
|
RemarkDisplayDTO remarkDisplayDTO = new RemarkDisplayDTO();
|
|
|
remarkDisplayDTO.setShowtype(i);
|
|
|
remarkDisplayDTO.setShowtypename(getShowtypeName(i, language));
|
|
|
remarkDisplayDTO.setAlign(0);//左对齐
|
|
|
int enter = 1;
|
|
|
if (i >= 6) //部门,人员,日期,时间 后不需要换行
|
|
|
enter = 0;
|
|
|
remarkDisplayDTO.setEnter(enter);
|
|
|
|
|
|
int isshow = 1;
|
|
|
if (i == 10)
|
|
|
isshow = 0;//操作默认不显示
|
|
|
remarkDisplayDTO.setIsshow(isshow);
|
|
|
result.add(remarkDisplayDTO);
|
|
|
|
|
|
if (i == 2) {//意见来源后面增加个 位置
|
|
|
RemarkDisplayDTO remarkDisplayDTO2 = new RemarkDisplayDTO();
|
|
|
remarkDisplayDTO2.setShowtype(11);
|
|
|
remarkDisplayDTO2.setAlign(0);//左对齐
|
|
|
remarkDisplayDTO2.setEnter(1);
|
|
|
remarkDisplayDTO2.setIsshow(1);
|
|
|
remarkDisplayDTO2.setShowtypename(getShowtypeName(11, language));
|
|
|
result.add(remarkDisplayDTO2);
|
|
|
}
|
|
|
|
|
|
if (i == 6) {//部门后面默认增加字符 /
|
|
|
RemarkDisplayDTO remarkDisplayDTO2 = new RemarkDisplayDTO();
|
|
|
remarkDisplayDTO2.setShowtype(0);
|
|
|
remarkDisplayDTO2.setAlign(0);//左对齐
|
|
|
remarkDisplayDTO2.setEnter(0);
|
|
|
remarkDisplayDTO2.setIsshow(1);
|
|
|
remarkDisplayDTO2.setTextvalue("/");
|
|
|
result.add(remarkDisplayDTO2);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取显示类型名称(处理意见-1 ,意见来源-2, 相关文档-3, 相关流程-4, 相关附件-5 ,操作部门-6 ,操作人-7 ,操作日期-8 ,操作时间-9, 操作-10 ,11-位置,文本-0)
|
|
|
*
|
|
|
* @param showtype
|
|
|
* @param language
|
|
|
* @return
|
|
|
*/
|
|
|
public String getShowtypeName(int showtype, int language) {
|
|
|
String result = "";
|
|
|
if (showtype == 1)
|
|
|
result = SystemEnv.getHtmlLabelName(21662, language);
|
|
|
else if (showtype == 2)
|
|
|
result = SystemEnv.getHtmlLabelName(129021, language);
|
|
|
else if (showtype == 3)
|
|
|
result = SystemEnv.getHtmlLabelName(857, language);
|
|
|
else if (showtype == 4)
|
|
|
result = SystemEnv.getHtmlLabelName(1044, language);
|
|
|
else if (showtype == 5)
|
|
|
result = SystemEnv.getHtmlLabelName(22194, language);
|
|
|
else if (showtype == 6)
|
|
|
result = SystemEnv.getHtmlLabelName(33826, language);
|
|
|
else if (showtype == 7)
|
|
|
result = SystemEnv.getHtmlLabelName(17482, language);
|
|
|
else if (showtype == 8)
|
|
|
result = SystemEnv.getHtmlLabelName(21663, language);
|
|
|
else if (showtype == 9)
|
|
|
result = SystemEnv.getHtmlLabelName(15502, language);
|
|
|
else if (showtype == 10)
|
|
|
result = SystemEnv.getHtmlLabelName(129022, language);
|
|
|
else if (showtype == 11)
|
|
|
result = SystemEnv.getHtmlLabelName(22981, language);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @param appHandWrittenSignID
|
|
|
* @param appSpeechAttahmentID
|
|
|
* @param remark
|
|
|
* @param mode 2表示HTML模式,0表示模式。
|
|
|
* @return
|
|
|
*/
|
|
|
private String appendSomeContent(String remark, int appHandWrittenSignID, int appSpeechAttahmentID, int mode, String remarkLocation) {
|
|
|
return appendSomeContent(remark,String.valueOf(appHandWrittenSignID),appSpeechAttahmentID,mode, remarkLocation,"");
|
|
|
}
|
|
|
|
|
|
private String appendSomeContent(String remark, String appHandWrittenSignID, int appSpeechAttahmentID, int mode, String remarkLocation,String speechAttachmente9) {
|
|
|
//处理手机版中所添加的来源的后缀。
|
|
|
String mobileSuffix = WorkflowSpeechAppend.getMobileSuffix(remark);
|
|
|
if (mobileSuffix != null) {
|
|
|
remark = remark.substring(0, remark.lastIndexOf(mobileSuffix));
|
|
|
}
|
|
|
|
|
|
if (mobileSuffix == null) {
|
|
|
String autoapprovsuffix = "<br/><br/><span _target='wfautoapprove' style='font-size:11px;color:#666;'>";
|
|
|
if (remark.indexOf(autoapprovsuffix) > 0) {
|
|
|
mobileSuffix = remark.substring(remark.indexOf(autoapprovsuffix));
|
|
|
remark = remark.substring(0, remark.indexOf(autoapprovsuffix));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//获取签字意见中的电子签章部分。
|
|
|
String eletriSignature = WorkflowSpeechAppend.getElectrSignatrue(remark);
|
|
|
if (eletriSignature != null) {
|
|
|
remark = remark.substring(0, remark.lastIndexOf(eletriSignature));
|
|
|
}
|
|
|
|
|
|
if (mode == 2) {
|
|
|
//HTML模式下,追加手写签批、语音附件内容和电子签章图片
|
|
|
if(appHandWrittenSignID!=null && !"".equals(appHandWrittenSignID)) {
|
|
|
String[] appHandWrittenSignIds = appHandWrittenSignID.split(",");
|
|
|
for(int i = 0;i < appHandWrittenSignIds.length;i++) {
|
|
|
int appHandWrittenSignId = Util.getIntValue(appHandWrittenSignIds[i]);
|
|
|
if (appHandWrittenSignId > 0) {
|
|
|
remark += "<br><img name=\"handWrittenSign\" class=\"handWrittenSign\" src=\""+weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fileid=" + DocDownloadCheckUtil.checkPermission(appHandWrittenSignId+"",user) + "\" ></img>";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if(appSpeechAttahmentID > 0) {
|
|
|
remark += "<br><embed name=\"speechAttachment\" height=\"25px\" width=\"300px\" name=\"speechPlayer\" src=\"audioPlayer.swf?audioUrl="+weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fileid=" + DocDownloadCheckUtil.checkPermission(appSpeechAttahmentID+"",user) + "\" type=\"application/x-shockwave-flash\"/>";
|
|
|
}
|
|
|
if(!"".equals(speechAttachmente9)) {
|
|
|
String[] speechIds = Util.splitString(speechAttachmente9,",");
|
|
|
for(String speechid : speechIds) {
|
|
|
int _speechid = Util.getIntValue(speechid);
|
|
|
if (_speechid > 0) {
|
|
|
DocAttachment attenchmentDoc = WorkflowSpeechAppend.getAttachment(_speechid);
|
|
|
String fileType = attenchmentDoc.getFiletype();
|
|
|
if (fileType.indexOf("/") >= 0) {
|
|
|
fileType = fileType.substring(fileType.indexOf("/") + 1);
|
|
|
|
|
|
String audioSrc = "data:audio/" + fileType + ";base64," + WorkflowSpeechAppend.getAppend(_speechid);
|
|
|
remark += "<audio controls preload=\"auto\"><source src='" + audioSrc + "'/></audio>";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (eletriSignature != null) {
|
|
|
remark += eletriSignature;
|
|
|
}
|
|
|
} else if (mode == 0) {
|
|
|
//模板模式下,只显示手写签批 电子签单,不显示语音附件
|
|
|
if(appHandWrittenSignID!=null && !"".equals(appHandWrittenSignID)) {
|
|
|
String[] appHandWrittenSignIds = appHandWrittenSignID.split(",");
|
|
|
for (int i = 0; i < appHandWrittenSignIds.length; i++) {
|
|
|
int appHandWrittenSignId = Util.getIntValue(appHandWrittenSignIds[i]);
|
|
|
if (appHandWrittenSignId > 0) {
|
|
|
remark += getSeparator2() + weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fileid=" + DocDownloadCheckUtil.checkPermission(appHandWrittenSignId+"",user) + getSeparator2();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//处理电子签章
|
|
|
if (eletriSignature != null) {
|
|
|
Document docObj = Jsoup.parse(eletriSignature, weaver.general.GCONST.XML_UTF8);
|
|
|
Elements elementObjs = docObj.getElementsByTag("img");
|
|
|
if (elementObjs.size() > 0) {
|
|
|
String imgURL = elementObjs.get(0).attr("src");
|
|
|
remark += getSeparator2() + imgURL;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//追加来源信息。
|
|
|
if (mobileSuffix != null) {
|
|
|
if(appHandWrittenSignID!=null && !"".equals(appHandWrittenSignID)) {
|
|
|
String[] appHandWrittenSignIds = appHandWrittenSignID.split(",");
|
|
|
for (int i = 0; i < appHandWrittenSignIds.length; i++) {
|
|
|
int appHandWrittenSignId = Util.getIntValue(appHandWrittenSignIds[i]);
|
|
|
if (appHandWrittenSignId > 0 && mode == 0)
|
|
|
remark += mobileSuffix.replaceAll("<br/><br/>", "");
|
|
|
else
|
|
|
remark += "<br>" + mobileSuffix.replaceAll("<br/><br/>", "");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return remark;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 解析签字意见中的图片,图片前后用分隔符分隔
|
|
|
*
|
|
|
* @param remarkContent
|
|
|
* @return
|
|
|
*/
|
|
|
private String checkImage(String remarkContent) {
|
|
|
String result = "";
|
|
|
BaseBean baseBean = new BaseBean();
|
|
|
Matcher slashMatcher = Pattern.compile("<img").matcher(remarkContent);
|
|
|
Matcher slashMatcher2 = Pattern.compile("/>").matcher(remarkContent);
|
|
|
String separator = (char) 3 + "";
|
|
|
int start = 0;
|
|
|
int end = 0;
|
|
|
while (slashMatcher.find()) {
|
|
|
start = slashMatcher.start();
|
|
|
if (start > 0)
|
|
|
result += separator + remarkContent.substring(end, start);
|
|
|
|
|
|
boolean flag = true;
|
|
|
while (flag) {
|
|
|
slashMatcher2.find();
|
|
|
end = slashMatcher2.end();
|
|
|
if (end > start)
|
|
|
flag = false;
|
|
|
}
|
|
|
if (end > 0)
|
|
|
result += separator + remarkContent.substring(start, end);
|
|
|
}
|
|
|
result += separator + remarkContent.substring(end);
|
|
|
|
|
|
if ("".equals(result))
|
|
|
result = remarkContent;
|
|
|
else
|
|
|
result = result.substring(1);
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 将img中地址http开头的地址改成 /weaver/weaver.file.FileDownload?fileid=&type=netimag&urlstr=。。。
|
|
|
*
|
|
|
* @param remarkContent
|
|
|
* @return
|
|
|
*/
|
|
|
private String checkNetImg(String remarkContent) {
|
|
|
String result = "";
|
|
|
|
|
|
Matcher slashMatcher = Pattern.compile("<img").matcher(remarkContent);
|
|
|
Matcher slashMatcher2 = Pattern.compile("/>").matcher(remarkContent);
|
|
|
String separator = (char) 3 + "";
|
|
|
int start = 0;
|
|
|
int end = 0;
|
|
|
while (slashMatcher.find()) {
|
|
|
start = slashMatcher.start();
|
|
|
if (start > 0)
|
|
|
result += remarkContent.substring(end, start);
|
|
|
boolean flag = true;
|
|
|
while (flag) {
|
|
|
slashMatcher2.find();
|
|
|
end = slashMatcher2.end();
|
|
|
if (end > start)
|
|
|
flag = false;
|
|
|
}
|
|
|
String img = remarkContent.substring(start, end);
|
|
|
String temp_img = "";
|
|
|
if (img.indexOf("src=\"http://") > -1) {
|
|
|
int ss = img.indexOf("src=\"http://") + 5;
|
|
|
int ee = img.lastIndexOf("\"");
|
|
|
String imgurl = img.substring(ss, ee);
|
|
|
temp_img += img.substring(0, ss);
|
|
|
int indexOf = imgurl.indexOf("/weaver/weaver.file.FileDownload");
|
|
|
if (indexOf >= 0)
|
|
|
temp_img += imgurl.substring(indexOf);
|
|
|
else
|
|
|
temp_img += weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fileid=&type=netimag&urlstr=" + URLEncoder.encode(imgurl);
|
|
|
temp_img += img.substring(ee);
|
|
|
} else
|
|
|
temp_img = img;
|
|
|
|
|
|
if (end > 0)
|
|
|
result += temp_img;
|
|
|
}
|
|
|
result += remarkContent.substring(end);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 一个节点可能有多个人提交的签字意见,用该特别字符来分割。
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public static char getNodeSeparator() {
|
|
|
return 3;
|
|
|
}
|
|
|
|
|
|
public static String getSeparator2() {
|
|
|
String result = (char) 1 + "";
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 取得下拉选择框的信息
|
|
|
*
|
|
|
* @param fieldname 字段名称
|
|
|
* @param isbill 是否单据
|
|
|
*/
|
|
|
public void getSelectItem(String fieldname, String isbill) {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String item = "";
|
|
|
String itemvalue = "";
|
|
|
String isdefault = "n";
|
|
|
String cancel = "";
|
|
|
int fieldid = 0;
|
|
|
int indx = fieldname.indexOf("_");
|
|
|
if (indx > 0) {
|
|
|
fieldname = fieldname.substring(0, indx);
|
|
|
}
|
|
|
fieldid = Util.getIntValue(Util.StringReplace(fieldname, "field", ""), 0);
|
|
|
SelectDefaults = new ArrayList();
|
|
|
SelectItems = new ArrayList();
|
|
|
SelectItemValues = new ArrayList();
|
|
|
SelectCancelValues = new ArrayList();
|
|
|
rs.executeSql("select selectname, selectvalue,isdefault,cancel from workflow_SelectItem where fieldid=" + fieldid + " and isbill=" + isbill + " ORDER BY listorder");
|
|
|
while (rs.next()) {
|
|
|
item = Util.toHtmlMode(rs.getString("selectname"));
|
|
|
cancel = Util.null2String(rs.getString("cancel"));
|
|
|
itemvalue = Util.null2String(rs.getString("selectvalue"));
|
|
|
isdefault = Util.null2String(rs.getString("isdefault"));
|
|
|
SelectItems.add(item);
|
|
|
SelectCancelValues.add(cancel);
|
|
|
SelectItemValues.add(itemvalue);
|
|
|
SelectDefaults.add(isdefault);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 取得BROWSER字段显示类型
|
|
|
*
|
|
|
* @param fieldvalue 字段
|
|
|
* @param fieldtype 字段类型
|
|
|
* @return
|
|
|
*/
|
|
|
public String getFieldName(String fieldvalue, int fieldtype) {
|
|
|
return getFieldName(fieldvalue, fieldtype, "");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 取得BROWSER字段显示类型
|
|
|
*
|
|
|
* @param fieldvalue 字段
|
|
|
* @param fieldtype 字段类型
|
|
|
* @param fielddbtype 数据类型
|
|
|
* @return
|
|
|
*/
|
|
|
public String getFieldName(String fieldvalue, int fieldtype, String fielddbtype){
|
|
|
return this.getFieldName(fieldvalue, fieldtype, fielddbtype, new HashMap<>());
|
|
|
}
|
|
|
public String getFieldName(String fieldvalue, int fieldtype, String fielddbtype, Map<String,Object> otherparams) {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String fieldname = "";
|
|
|
if (fieldtype != 2 && fieldtype != 290 && fieldtype != 19 && fieldtype != 402 && fieldtype != 403 && fieldvalue != null && !fieldvalue.trim().equals("") && fieldtype != 226) {
|
|
|
fieldvalue = fieldvalue.trim();
|
|
|
if (fieldvalue.substring(fieldvalue.length() - 1).equals(","))
|
|
|
fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1);
|
|
|
ArrayList tempshowidlist = Util.TokenizerString(fieldvalue, ",");
|
|
|
if (fieldtype == 8 || fieldtype == 135) {
|
|
|
//项目,多项目
|
|
|
for (int k = 0; k < tempshowidlist.size(); k++) {
|
|
|
fieldname += Util.StringReplace(prjcominfo.getProjectInfoname((String) tempshowidlist.get(k)), ",", ",") + ",";
|
|
|
}
|
|
|
} else if (fieldtype == 1 || fieldtype == 17 || fieldtype == 160 || fieldtype == 165 || fieldtype == 166) {
|
|
|
//人员,多人员
|
|
|
for (int k = 0; k < tempshowidlist.size(); k++) {
|
|
|
fieldname += resourcecominfo.getLastname((String) tempshowidlist.get(k)) + ",";
|
|
|
}
|
|
|
} else if (fieldtype == 7 || fieldtype == 18) {
|
|
|
//客户,多客户
|
|
|
for (int k = 0; k < tempshowidlist.size(); k++) {
|
|
|
fieldname += Util.StringReplace(crmcominfo.getCustomerInfoname((String) tempshowidlist.get(k)), ",", ",") + ",";
|
|
|
}
|
|
|
} else if (fieldtype == 4 || fieldtype == 57 || fieldtype == 167 || fieldtype == 168) {
|
|
|
//部门,多部门
|
|
|
for (int k = 0; k < tempshowidlist.size(); k++) {
|
|
|
String showdeptname = "";
|
|
|
String showdeptid = (String) tempshowidlist.get(k);
|
|
|
if (!"".equals(showdeptid)) {
|
|
|
showdeptname = orgShowBiz.getDepartmentShow("workflow", showdeptid);
|
|
|
}
|
|
|
fieldname += Util.StringReplace(showdeptname, ",", ",") + ",";
|
|
|
}
|
|
|
} else if (fieldtype == 164 || fieldtype == 194 || fieldtype == 169 || fieldtype == 170) {
|
|
|
//分部,多分部
|
|
|
for (int k = 0; k < tempshowidlist.size(); k++) {
|
|
|
String showsubcompname = "";
|
|
|
String showsubcompid = (String) tempshowidlist.get(k);
|
|
|
if (!"".equals(showsubcompid)) {
|
|
|
showsubcompname = orgShowBiz.getSubcompanyShow("workflow", showsubcompid);
|
|
|
}
|
|
|
fieldname += Util.StringReplace(showsubcompname, ",", ",") + ",";
|
|
|
}
|
|
|
} else if (fieldtype == 9 || fieldtype == 37) {
|
|
|
//文档,多文档
|
|
|
for (int k = 0; k < tempshowidlist.size(); k++) {
|
|
|
fieldname += Util.StringReplace(docominfo.getDocname((String) tempshowidlist.get(k)), ",", ",") + ",";
|
|
|
}
|
|
|
} else if (fieldtype == 23) {
|
|
|
//资产
|
|
|
for (int k = 0; k < tempshowidlist.size(); k++) {
|
|
|
fieldname += Util.StringReplace(capitalcominfo.getCapitalname((String) tempshowidlist.get(k)), ",", ",") + ",";
|
|
|
}
|
|
|
} else if (fieldtype == 16 || fieldtype == 152 || fieldtype == 171) {
|
|
|
//相关请求
|
|
|
for (int k = 0; k < tempshowidlist.size(); k++) {
|
|
|
fieldname += Util.StringReplace(wfrequestcominfo.getRequestName((String) tempshowidlist.get(k)), ",", ",") + ",";
|
|
|
}
|
|
|
} else if (fieldtype == 161 || fieldtype == 162) {
|
|
|
boolean hasRowKey = otherparams.containsKey("detailRecordId");
|
|
|
int detailRecordId = hasRowKey ? Util.getIntValue(otherparams.get("detailRecordId")+"") : -1;
|
|
|
int rowIndex = otherparams.containsKey("rowIndex") ? Util.getIntValue(otherparams.get("rowIndex")+"") : -1;
|
|
|
int fieldid = Util.getIntValue(otherparams.get("fieldid")+"");
|
|
|
// String cacheKey = hasRowKey && fieldid>0 ? this.Requestid + "_field" + fieldid + "_" + detailRecordId : "";
|
|
|
// BrowserFieldValueComInfo valueComInfo = new BrowserFieldValueComInfo();
|
|
|
// String fieldValueCache = "".equals(cacheKey) ? "" : Util.null2String(valueComInfo.getFieldValue(cacheKey));
|
|
|
// String fieldValueShowNameCache = "".equals(cacheKey) ? "" : valueComInfo.getFieldValueShowName(cacheKey);
|
|
|
// List<String> fieldvalspanarr = Util.splitString2List(fieldValueShowNameCache, BrowserFieldUtil.BROWSER_SHOW_NAME_SPLITER);
|
|
|
// boolean isUseCache = !"".equals(fieldValueCache) && fieldValueCache.equals(fieldvalue) && fieldvalspanarr.size() == tempshowidlist.size();
|
|
|
if (false) { //走缓存
|
|
|
// for (int j = 0; j < tempshowidlist.size(); j++) {
|
|
|
// fieldname += Util.null2String(fieldvalspanarr.get(j)) + ",";
|
|
|
// }
|
|
|
} else {
|
|
|
int languageId = this.user != null ? user.getLanguage() : 7;
|
|
|
List<Object> browserInfo;
|
|
|
try {
|
|
|
BrowserValueInfoService browserValueInfoService = new BrowserValueInfoService();
|
|
|
Map<String, Object> customizeBrowserValueCache = new HashMap<>();
|
|
|
if (this.Requestid > 0)
|
|
|
customizeBrowserValueCache = BrowserFieldUtil.loadRequestCustomizeBrowserValues(this.Requestid);
|
|
|
browserValueInfoService.setParams(customizeBrowserValueCache);
|
|
|
HashMap<String,Object> cusDependFieldValues = this.calculateCusBrowserFieldValue(fieldid,String.valueOf(fieldtype),fielddbtype,String.valueOf(this.Requestid),detailRecordId);
|
|
|
Map<String, Object> browserOtherParams = new HashMap<>();
|
|
|
browserOtherParams.put("cusDependFieldValues", cusDependFieldValues);
|
|
|
browserOtherParams.put("detailRecordId", detailRecordId);
|
|
|
browserOtherParams.put("moduleName4Org", "workflow");
|
|
|
browserInfo = browserValueInfoService.getBrowserValueInfo(fieldtype, fielddbtype, fieldid, fieldvalue, languageId, this.Requestid, browserOtherParams);
|
|
|
for(Object value:browserInfo){
|
|
|
BrowserValueInfo browserValueInfo = (BrowserValueInfo)value;
|
|
|
String browserValue = browserValueInfo!=null?browserValueInfo.getName():"";
|
|
|
fieldname+=browserValue+",";
|
|
|
}
|
|
|
if(fieldname.endsWith(",")){
|
|
|
fieldname = fieldname.substring(0,fieldname.length()-1);
|
|
|
}
|
|
|
// fieldname = new CustomBrowserBiz().calculateBrowserName(fieldvalue, fielddbtype, fieldtype, this.Requestid, ",", rowIndex, detailRecordId);
|
|
|
// if (fieldtype == 161 && fieldname.length() > 0) {
|
|
|
// String fieldValName= fieldname;
|
|
|
// if(fieldname.endsWith(",")){
|
|
|
// fieldValName = fieldname.substring(0, fieldname.length()-1);
|
|
|
// }
|
|
|
// CustomizeBrowserRefreshCacheThread.addParaInQueue("field" + fieldid, fieldvalue, fieldValName, this.Requestid, detailRecordId);
|
|
|
// }
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
} else if (fieldtype == 256 || fieldtype == 257) {//自定义多选
|
|
|
for (int k = 0; k < tempshowidlist.size(); k++) {
|
|
|
try {
|
|
|
CustomTreeUtil customTreeUtil = new CustomTreeUtil();
|
|
|
String name = customTreeUtil.getTreeFieldShowName((String) tempshowidlist.get(k), fielddbtype, "onlyname");
|
|
|
fieldname += Util.StringReplace(name, ",", ",") + ",";
|
|
|
} catch (Exception e) {
|
|
|
System.out.println(e);
|
|
|
}
|
|
|
}
|
|
|
} else if (fieldtype == 142) {
|
|
|
//收发文单位
|
|
|
for (int k = 0; k < tempshowidlist.size(); k++) {
|
|
|
fieldname += Util.StringReplace(docReceiveUnitComInfo.getReceiveUnitName("" + tempshowidlist.get(k)), ",", ",") + ",";
|
|
|
}
|
|
|
} else if (fieldtype == 141) {
|
|
|
int languageId = this.user != null ? user.getLanguage() : 7;
|
|
|
ResourceConditionManager resourceConditionManager = new ResourceConditionManager();
|
|
|
fieldname = resourceConditionManager.getFormShowNameOfNoLink(fieldvalue, languageId);
|
|
|
} else if (fieldtype == 296) { //多维度预算周期
|
|
|
BudgetPeriodComInfo budgetPeriodComInfo = new BudgetPeriodComInfo();
|
|
|
fieldname = budgetPeriodComInfo.getPeriodName(fieldvalue);
|
|
|
|
|
|
} else if (fieldtype == 295) {// 多维度承担主体
|
|
|
BudgetBearerComInfo budgetBearerComInfo = new BudgetBearerComInfo();
|
|
|
fieldname = budgetBearerComInfo.getBudgetBearerName(fieldvalue);
|
|
|
} else if (fieldtype == 294) {//多维度预算科目
|
|
|
BudgetSubjectComInfo budgetSubjectComInfo = new BudgetSubjectComInfo();
|
|
|
fieldname = budgetSubjectComInfo.getSubjectname(fieldvalue);
|
|
|
} else if(fieldtype ==22){ //报销费用类型
|
|
|
FnaSystemSetComInfo fnaSystemSetComInfo = new FnaSystemSetComInfo();
|
|
|
RecordSet recordSet = new RecordSet();
|
|
|
String separator = Util.null2String(fnaSystemSetComInfo.get_separator()).trim();
|
|
|
int enableDispalyAll = Util.getIntValue(fnaSystemSetComInfo.get_enableDispalyAll());
|
|
|
String fullName = "";
|
|
|
if (enableDispalyAll == 1) {
|
|
|
BudgetfeeTypeComInfo budgetfeeTypeComInfo = new BudgetfeeTypeComInfo();
|
|
|
fullName = budgetfeeTypeComInfo.getSubjectFullName(fieldvalue, separator);
|
|
|
} else {
|
|
|
BrowserComInfo bci = new BrowserComInfo();
|
|
|
String tablename = bci.getBrowsertablename(fieldtype + ""); // 浏览框对应的表,比如人力资源表
|
|
|
String columname = bci.getBrowsercolumname(fieldtype + ""); // 浏览框对应的表名称字段
|
|
|
String keycolumname = bci.getBrowserkeycolumname(fieldtype + ""); // 浏览框对应的表值字段
|
|
|
recordSet.execute("select " + columname + " from " + tablename + " where " + keycolumname + " in (" + fieldvalue + ")");
|
|
|
if (recordSet.next()) {
|
|
|
fullName = recordSet.getString(1);
|
|
|
}
|
|
|
}
|
|
|
fieldname = fullName;
|
|
|
|
|
|
}else {
|
|
|
String tablename = urlcominfo.getBrowsertablename("" + fieldtype); //浏览框对应的表,比如人力资源表
|
|
|
String columname = urlcominfo.getBrowsercolumname("" + fieldtype); //浏览框对应的表名称字段
|
|
|
String keycolumname = urlcominfo.getBrowserkeycolumname("" + fieldtype); //浏览框对应的表值字段
|
|
|
|
|
|
String dbtype = urlcominfo.getBrowserdbtype("" + fieldtype); //浏览框对应的数据类型
|
|
|
|
|
|
// 多人力资源,多客户,多会议,多文档
|
|
|
//安全检查
|
|
|
if (tablename != null && !tablename.equals("")
|
|
|
&& columname != null && !columname.equals("")
|
|
|
&& keycolumname != null && !keycolumname.equals("")
|
|
|
) {
|
|
|
String sql = "";
|
|
|
if (fieldvalue.indexOf(",") != -1) {
|
|
|
String[] fieldvalues = fieldvalue.split(",");
|
|
|
for (int f = 0; f < fieldvalues.length; f++) {
|
|
|
if (dbtype != null && dbtype.indexOf("varchar") >= 0) {
|
|
|
sql = "select " + keycolumname + "," + columname + " from " + tablename + " where " + keycolumname + "='" + fieldvalues[f] + "'";
|
|
|
} else {
|
|
|
sql = "select " + keycolumname + "," + columname + " from " + tablename + " where " + keycolumname + "=" + fieldvalues[f];
|
|
|
}
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
fieldname += Util.StringReplace(rs.getString(2), ",", ",") + ",";
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
if (dbtype != null && dbtype.indexOf("varchar") >= 0) {
|
|
|
sql = "select " + keycolumname + "," + columname + " from " + tablename + " where " + keycolumname + "='" + fieldvalue + "'";
|
|
|
} else {
|
|
|
sql = "select " + keycolumname + "," + columname + " from " + tablename + " where " + keycolumname + "=" + fieldvalue;
|
|
|
}
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
fieldname += Util.StringReplace(rs.getString(2), ",", ",") + ",";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (fieldname.length() > 0 && fieldname.endsWith(",")) {
|
|
|
fieldname = fieldname.substring(0, fieldname.length() - 1);
|
|
|
}
|
|
|
} else {
|
|
|
fieldname = fieldvalue;
|
|
|
}
|
|
|
return fieldname;
|
|
|
}
|
|
|
|
|
|
private HashMap<String, Object> calculateCusBrowserFieldValue(int fieldid, String detailtype, String fielddbtype, String requestId, int detailRecordId) {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
int workflowid = -1;
|
|
|
rs.executeQuery("select mainrequestid,requestid,requestname,requestlevel,mainrequestid,creater,creatertype,createdate,createtime,workflowId,currentstatus,currentnodeid,currentnodetype,status,remindTypes,docids,crmids,prjids,cptids , lastnodeid from workflow_requestbase where requestid=?", requestId);
|
|
|
if (rs.next()) {
|
|
|
workflowid = (rs.getInt("workflowId"));
|
|
|
} else {
|
|
|
return null;
|
|
|
}
|
|
|
WorkflowAllComInfo comInfo = new WorkflowAllComInfo();
|
|
|
String isbill = comInfo.getIsBill(workflowid + "");
|
|
|
String formid = comInfo.getFormId(workflowid + "");
|
|
|
|
|
|
List<HashMap<String, Object>> fieldinfos = this.getFieldNameMapId(requestId,isbill,formid);
|
|
|
HashMap<String, Object> mainfieldinfomap = fieldinfos.get(0);
|
|
|
HashMap<String, Object> detailfieldinfomap = fieldinfos.get(1);
|
|
|
HashMap<String, Object> fieldNameMapId = fieldinfos.get(2);
|
|
|
|
|
|
BrowserInitUtil browserInitUtil = new BrowserInitUtil();
|
|
|
List<String> fieldList = null;
|
|
|
List<Map<String,String>> cusDependShip= new ArrayList<>();
|
|
|
BrowserBean browserbean = new BrowserBean(detailtype+"");
|
|
|
weaver.interfaces.workflow.browser.Browser browser = null;
|
|
|
if(user==null){
|
|
|
user=new User();
|
|
|
}
|
|
|
browser = browserInitUtil.initCustomizeBrow(browserbean, fielddbtype, Util.getIntValue(detailtype), user.getUID());
|
|
|
if (browser.getRequestFieldMap() != null) {
|
|
|
fieldList = new ArrayList<>(browser.getRequestFieldMap());
|
|
|
List<String> relateFieldid = new ArrayList<String>();
|
|
|
for (String fieldKey : fieldList) {
|
|
|
String dependfieldid = (String) fieldNameMapId.get(Util.null2String(fieldKey).toLowerCase());
|
|
|
if(dependfieldid == null)
|
|
|
continue;
|
|
|
boolean isMainField = mainfieldinfomap != null && mainfieldinfomap.containsKey(dependfieldid);
|
|
|
relateFieldid.add(dependfieldid + (isMainField ? "_0" : "_1"));
|
|
|
Map<String,String> dependShip = new HashMap<>();
|
|
|
dependShip.put("key", fieldKey);
|
|
|
dependShip.put("fieldid", dependfieldid);
|
|
|
dependShip.put("isDetail", isMainField ? "0" : "1");
|
|
|
cusDependShip.add(dependShip);
|
|
|
}
|
|
|
browserbean.setRelateFieldid(relateFieldid);
|
|
|
}
|
|
|
|
|
|
HashMap<String, Object> dependFieldValues = new HashMap<>();
|
|
|
boolean isCalDetailField = detailfieldinfomap != null && detailfieldinfomap.containsKey(fieldid);
|
|
|
if(cusDependShip != null && cusDependShip.size() > 0){
|
|
|
for(Map<String,String> item: cusDependShip){
|
|
|
boolean isDetail = "1".equals(item.get("isDetail"));
|
|
|
String key = item.get("key");
|
|
|
String fieldidDep = item.get("fieldid");
|
|
|
String dTableName = "";
|
|
|
if(isDetail){
|
|
|
HashMap<String, Object> fieldmap = (HashMap<String, Object>) detailfieldinfomap.get(fieldidDep);
|
|
|
dTableName = (String)fieldmap.get("tablename");
|
|
|
}
|
|
|
// String replaceStr = Util.null2String(isbill.equals("0") ? "detail" : dTableName);
|
|
|
// String fieldname = isDetail && !"".equals(replaceStr) ? key.replace(replaceStr+"_", "") : key;
|
|
|
RequestInfoEntity requestInfoEntity = FieldInfoBiz.getRequestinfo(requestId);
|
|
|
Map<String, Object> maindata = requestInfoEntity.getLazyMainTableInfoEntity().get().getDatas();
|
|
|
List<DetailTableInfoEntity> detailTableInfoEntities = requestInfoEntity.getLazyDetailTableInfos().get();
|
|
|
String fieldValue = "";
|
|
|
if(!isDetail){ //明细字段取主字段依赖
|
|
|
if(maindata.containsKey(fieldidDep))
|
|
|
fieldValue = (String)maindata.get(fieldidDep);
|
|
|
}else{
|
|
|
String detailtablename = key.substring(0, key.lastIndexOf("_"));
|
|
|
for (DetailTableInfoEntity dtinfo : detailTableInfoEntities) {
|
|
|
if (dtinfo.getTableDbName().equals(detailtablename)) {
|
|
|
if (dtinfo != null) {
|
|
|
for (DetailRowInfoEntity detailRowInfoEntity : dtinfo.getDetailRowInfos()) {
|
|
|
if (detailRowInfoEntity.getId() == detailRecordId) {
|
|
|
fieldValue = detailRowInfoEntity.getDatas() != null ? (String) detailRowInfoEntity.getDatas().get(fieldidDep) : "";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
dependFieldValues.put(key, fieldValue);
|
|
|
}
|
|
|
}
|
|
|
return dependFieldValues;
|
|
|
}
|
|
|
|
|
|
private List<HashMap<String, Object>> getFieldNameMapId(String requestId,String isbill,String formid) {
|
|
|
|
|
|
HashMap<String,Object> fieldNameMapId = new HashMap<>();
|
|
|
HashMap<String,Object> mainfieldinfomap = new HashMap<>();
|
|
|
HashMap<String,Object> detailfieldinfomap = new HashMap<>();
|
|
|
String queryFormFieldSQL = NewReportBiz.getQueryFormFieldSQL(getIntValue(formid), getIntValue(isbill));
|
|
|
RecordSet rsform = new RecordSet();
|
|
|
rsform.executeQuery(queryFormFieldSQL);
|
|
|
List<HashMap<String, Object>> fieldInfos = new ArrayList<>();
|
|
|
while (rsform.next()) {
|
|
|
String fieldname = null2String(rsform.getString("name"));
|
|
|
String fieldid = null2String(rsform.getString("id"));
|
|
|
String dbtype = null2String(rsform.getString("dbtype"));
|
|
|
String htmltype = null2String(rsform.getString("httype"));
|
|
|
String filetype = null2String(rsform.getString("type"));
|
|
|
int viewtype = getIntValue(rsform.getString("viewtype"));
|
|
|
String maintablename = null2String(rsform.getString("maintablename"));
|
|
|
String detailtablename = null2String(rsform.getString("detailtable"));
|
|
|
if(viewtype==1){
|
|
|
HashMap<String ,String> fieldmap = new HashMap<>();
|
|
|
fieldmap.put("fieldname",fieldname);
|
|
|
fieldmap.put("tablename",detailtablename);
|
|
|
detailfieldinfomap.put(fieldid,fieldmap);
|
|
|
}else {
|
|
|
HashMap<String ,String> fieldmap = new HashMap<>();
|
|
|
fieldmap.put("fieldname",fieldname);
|
|
|
fieldmap.put("tablename",maintablename);
|
|
|
mainfieldinfomap.put(fieldid,fieldmap);
|
|
|
}
|
|
|
fieldNameMapId.put(((viewtype == 1 ? (detailtablename+"_") : "") + fieldname).toLowerCase() , fieldid+"");
|
|
|
}
|
|
|
fieldInfos.add(mainfieldinfomap);
|
|
|
fieldInfos.add(detailfieldinfomap);
|
|
|
fieldInfos.add(fieldNameMapId);
|
|
|
return fieldInfos;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 取得相关文挡内容
|
|
|
*
|
|
|
* @param fieldvalue 相关文挡字段值
|
|
|
* @return 相关文挡内容
|
|
|
*/
|
|
|
public String getFileName(String fieldvalue) {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String filename = "";
|
|
|
if (fieldvalue != null && !fieldvalue.trim().equals("")) {
|
|
|
fieldvalue = fieldvalue.trim();
|
|
|
if (fieldvalue.substring(fieldvalue.length() - 1).equals(","))
|
|
|
fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1);
|
|
|
//String sql="select docsubject from docdetail where id in ("+fieldvalue+")";
|
|
|
String sql = "select t1.imageFileName as docsubject from DocImageFile t1,"
|
|
|
+ "(select docid,max(versionid) versionid from DocImageFile group by docid) t2"
|
|
|
+ " where t1.docid=t2.docid and t1.versionid=t2.versionid "
|
|
|
+ " and t1.docId in (" + fieldvalue + ") order by t1.id asc ";
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
if (!filename.equals("")) {
|
|
|
filename += ",";
|
|
|
}
|
|
|
filename += Util.StringReplace(rs.getString("docsubject"), ",", ",");
|
|
|
}
|
|
|
}
|
|
|
return filename;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 替换特殊字符
|
|
|
*
|
|
|
* @param s 要替换特殊的字符串
|
|
|
* @return 替换完成的字符串
|
|
|
*/
|
|
|
public String toScreen(String s) {
|
|
|
char c[] = s.toCharArray();
|
|
|
char ch;
|
|
|
int i = 0;
|
|
|
StringBuffer buf = new StringBuffer();
|
|
|
|
|
|
while (i < c.length) {
|
|
|
ch = c[i++];
|
|
|
|
|
|
if (ch == '\r')
|
|
|
buf.append("");
|
|
|
else if (ch == '\n')
|
|
|
buf.append("");
|
|
|
else
|
|
|
buf.append(ch);
|
|
|
}
|
|
|
return buf.toString();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 替换特殊字符
|
|
|
*
|
|
|
* @param s 要替换特殊的字符串
|
|
|
* @return 替换完成的字符串
|
|
|
*/
|
|
|
public String toExcel(String s) {
|
|
|
if (s == null) return "";
|
|
|
//因本方法会将字符串 &符号转换,故先将欧元符号转义符转换为其Unicode码
|
|
|
s = s.replaceAll("€", "\u20AC");
|
|
|
String str = toScreen(s);
|
|
|
str = Util.StringReplace(str, "∠", "∠");
|
|
|
str = Util.StringReplace(str, "φ", "φ");
|
|
|
str = Util.StringReplace(str, """, "\"");
|
|
|
str = Util.StringReplace(str, " ", "%nbsp");
|
|
|
//str=Util.StringReplace(str,"'","‘");
|
|
|
str = Util.StringReplace(str, "<", "<");
|
|
|
str = Util.StringReplace(str, ">", ">");
|
|
|
str = Util.StringReplace(str, "&dt;&at;", "<br>");
|
|
|
str = Util.StringReplace(str, "&", "&");
|
|
|
str = Util.StringReplace(str, "<br>", "&dt;&at;");
|
|
|
if ("&dt;&at;".equals(str)) {
|
|
|
str = "";
|
|
|
}
|
|
|
//在方法最后,又将欧元符号置换为转义符
|
|
|
str = str.replaceAll("\u20AC", "€");
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
*/
|
|
|
public String dropScript(String s) {
|
|
|
String retStr = "";
|
|
|
while (s.toLowerCase().indexOf("<script") != -1) {
|
|
|
int startindx = s.toLowerCase().indexOf("<script");
|
|
|
int endindx = s.toLowerCase().indexOf("</script>");
|
|
|
if (endindx != -1 && endindx > startindx) {
|
|
|
retStr += s.substring(0, startindx);
|
|
|
s = s.substring(endindx + 9);
|
|
|
}
|
|
|
if (endindx == -1) {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
retStr += s;
|
|
|
return retStr;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 拆分节点的批注
|
|
|
*
|
|
|
* @param nodeMark 节点批注
|
|
|
* @return 拆分所得结果
|
|
|
*/
|
|
|
public static List getNodeRemarkListOfBeenSplited(String nodeMark) {
|
|
|
List nodeRemarkListOfBeenSplited = new ArrayList();
|
|
|
|
|
|
//安全检查
|
|
|
if (nodeMark == null || nodeMark.trim().equals("")) {
|
|
|
return nodeRemarkListOfBeenSplited;
|
|
|
}
|
|
|
List tempList = new ArrayList();
|
|
|
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
|
|
|
char c[] = nodeMark.toCharArray();
|
|
|
char ch;
|
|
|
int i = 0;
|
|
|
while (i < c.length) {
|
|
|
ch = c[i++];
|
|
|
|
|
|
if (ch == Util.getSeparator()) {
|
|
|
if (!sb.toString().equals("")) {
|
|
|
tempList.add(sb.toString());
|
|
|
sb = new StringBuffer();
|
|
|
}
|
|
|
} else {
|
|
|
sb.append(ch);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (!sb.toString().equals("")) {
|
|
|
tempList.add(sb.toString());
|
|
|
}
|
|
|
|
|
|
String tempString = null;
|
|
|
int indexOfBROne = 0;
|
|
|
Map nodeRemarkOfBeenSplitedMap = null;
|
|
|
for (i = 0; i < tempList.size(); i++) {
|
|
|
|
|
|
tempString = (String) tempList.get(i);
|
|
|
if (tempString == null || tempString.trim().equals("")) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
indexOfBROne = tempString.indexOf("<br>");
|
|
|
if (indexOfBROne >= 0) {
|
|
|
nodeRemarkOfBeenSplitedMap = new HashMap();
|
|
|
|
|
|
if (tempString.indexOf("/weaver/weaver.file.FileDownload?fileid=") >= 0
|
|
|
|| tempString.indexOf("/weaver/weaver.file.ImgFileDownload?userid=") >= 0) {
|
|
|
nodeRemarkOfBeenSplitedMap.put("imageNodeRemark", tempString.substring(0, indexOfBROne));
|
|
|
nodeRemarkOfBeenSplitedMap.put("strNodeRemark", tempString.substring(indexOfBROne + "<br>".length()));
|
|
|
} else {
|
|
|
nodeRemarkOfBeenSplitedMap.put("imageNodeRemark", "");
|
|
|
nodeRemarkOfBeenSplitedMap.put("strNodeRemark", tempString);
|
|
|
}
|
|
|
|
|
|
|
|
|
nodeRemarkListOfBeenSplited.add(nodeRemarkOfBeenSplitedMap);
|
|
|
} else {
|
|
|
|
|
|
if (tempString.indexOf("/weaver/weaver.file.FileDownload?fileid=") >= 0
|
|
|
|| tempString.indexOf("/weaver/weaver.file.ImgFileDownload?userid=") >= 0) {
|
|
|
nodeRemarkOfBeenSplitedMap = new HashMap();
|
|
|
nodeRemarkOfBeenSplitedMap.put("imageNodeRemark", tempString);
|
|
|
nodeRemarkOfBeenSplitedMap.put("strNodeRemark", "");
|
|
|
nodeRemarkListOfBeenSplited.add(nodeRemarkOfBeenSplitedMap);
|
|
|
} else {
|
|
|
nodeRemarkOfBeenSplitedMap = new HashMap();
|
|
|
nodeRemarkOfBeenSplitedMap.put("imageNodeRemark", "");
|
|
|
nodeRemarkOfBeenSplitedMap.put("strNodeRemark", tempString);
|
|
|
nodeRemarkListOfBeenSplited.add(nodeRemarkOfBeenSplitedMap);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
return nodeRemarkListOfBeenSplited;
|
|
|
}
|
|
|
|
|
|
public static List getNodeRemarkList(String nodeRemark) {
|
|
|
try {
|
|
|
List lstResult = new ArrayList();
|
|
|
//安全检查
|
|
|
if (nodeRemark == null || nodeRemark.trim().equals("")) {
|
|
|
return lstResult;
|
|
|
}
|
|
|
|
|
|
String[] arrRequestLogs = nodeRemark.split(String.valueOf(getNodeSeparator()));
|
|
|
String nodeRemarknew = "";
|
|
|
for (String s : arrRequestLogs) {
|
|
|
if (s.indexOf("/weaver/weaver.file.FileDownload?fileid=") >= 0
|
|
|
|| s.indexOf("/weaver/weaver.file.ImgFileDownload?userid=") >= 0
|
|
|
|| s.indexOf("/weaver/weaver.file.SignatureDownLoad?markId=") >= 0) {
|
|
|
s = s.replaceAll("" + getSeparator2(), "" + getNodeSeparator());
|
|
|
} else
|
|
|
s = s.replaceAll("" + getSeparator2(), "");
|
|
|
if ("".equals(nodeRemarknew))
|
|
|
nodeRemarknew += s;
|
|
|
else
|
|
|
nodeRemarknew += getNodeSeparator() + s;
|
|
|
}
|
|
|
arrRequestLogs = nodeRemarknew.split(String.valueOf(getNodeSeparator()));
|
|
|
for (int m = 0; m < arrRequestLogs.length; m++) {
|
|
|
if (arrRequestLogs[m] == null || arrRequestLogs[m].trim().equals("")) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
String[] arrNodeString = arrRequestLogs[m].split(String.valueOf(Util.getSeparator()));
|
|
|
int lenArrNodeString = arrNodeString.length;
|
|
|
for (int i = 0; i < lenArrNodeString; i++) {
|
|
|
String tempString = arrNodeString[i];
|
|
|
//如果数组元素为空,则不作任何处理。
|
|
|
if (tempString.trim().equalsIgnoreCase("<br>") || tempString.trim().equalsIgnoreCase("<br/>")
|
|
|
|| tempString.trim().equals("") || tempString.trim().equalsIgnoreCase("<br><br/>")) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
if (tempString.endsWith("<br>")) {
|
|
|
tempString = tempString.substring(0, tempString.length() - 4);
|
|
|
}
|
|
|
|
|
|
//标识本次循环中,只包含纯文本信息不包含任何图片,则将该文本信息移到下一单元格来进行显示。
|
|
|
boolean flagOnlyText = (tempString.indexOf("/weaver/weaver.file.FileDownload") == -1)
|
|
|
&& (tempString.indexOf("/weaver/weaver.file.ImgFileDownload") == -1)
|
|
|
&& (tempString.indexOf("/weaver/weaver.file.SignatureDownLoad") == -1);
|
|
|
//另外,需要检查当前操作者所提交的签字意见是否仅包含文字内容。否则数组可能越界。
|
|
|
if (flagOnlyText && (i + 1) < lenArrNodeString) {
|
|
|
String nextNodeString = arrNodeString[i + 1];
|
|
|
int indexOf = nextNodeString.indexOf("<br>");
|
|
|
if (indexOf == -1) {
|
|
|
nextNodeString = nextNodeString + "<br>" + tempString;
|
|
|
} else {
|
|
|
nextNodeString = nextNodeString.substring(0, indexOf) + "<br>" + tempString + nextNodeString.substring(indexOf);
|
|
|
}
|
|
|
arrNodeString[i + 1] = nextNodeString;
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
Map mapTempObj = new HashMap();
|
|
|
boolean flag = tempString.startsWith("/weaver/weaver.file.FileDownload?")
|
|
|
|| tempString.startsWith("/weaver/weaver.file.ImgFileDownload?")
|
|
|
|| tempString.startsWith("/weaver/weaver.file.SignatureDownLoad?");
|
|
|
if (flag) {
|
|
|
//处理仅包含电子签章一种图片来源的数据片段
|
|
|
int indexOf = tempString.indexOf("<br>");
|
|
|
if (indexOf == -1) {
|
|
|
mapTempObj.put("imageNodeRemark", tempString);
|
|
|
mapTempObj.put("strNodeRemark", "");
|
|
|
lstResult.add(mapTempObj);
|
|
|
//处理仅包含表单签章一种图片来源的数据片段
|
|
|
} else {
|
|
|
mapTempObj.put("imageNodeRemark", tempString.substring(0, indexOf));
|
|
|
mapTempObj.put("strNodeRemark", tempString.substring(indexOf + 4));
|
|
|
lstResult.add(mapTempObj);
|
|
|
}
|
|
|
} else {
|
|
|
//处理既包含手写签批图片、又包含文字等片段的复杂数据片段。暂时仅处理包含一张图片的情况。
|
|
|
String imageNodeStrng = "";
|
|
|
Document docObj = Jsoup.parse(tempString, "UTF-8");
|
|
|
Elements elementObjs = docObj.getElementsByTag("img");
|
|
|
if (elementObjs.size() > 0) {
|
|
|
imageNodeStrng = elementObjs.get(0).attr("src");
|
|
|
elementObjs.get(0).remove();
|
|
|
}
|
|
|
|
|
|
Element bodyEle = docObj.getElementsByTag("body").first();
|
|
|
String textNodeString = (bodyEle != null) ? bodyEle.html() : "";
|
|
|
textNodeString = textNodeString.replaceAll("\r", "");
|
|
|
textNodeString = textNodeString.replaceAll("\n", "");
|
|
|
mapTempObj.put("imageNodeRemark", imageNodeStrng);
|
|
|
mapTempObj.put("strNodeRemark", textNodeString);
|
|
|
lstResult.add(mapTempObj);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return lstResult;
|
|
|
} catch (Exception e) {
|
|
|
log.error("Catch a exception.", e);
|
|
|
return new ArrayList();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 拆分节点的批注
|
|
|
*
|
|
|
* @param nodeMark 节点批注
|
|
|
* @param nodeRemarkListOfBeenSplited 拆分所得结果
|
|
|
* @return 拆分所得结果
|
|
|
*/
|
|
|
public static ArrayList getNodeRemarkListOfBeenSplited(String nodeMark, ArrayList nodeRemarkListOfBeenSplited) {
|
|
|
|
|
|
//安全检查
|
|
|
if (nodeMark == null || nodeMark.trim().equals("")) {
|
|
|
return nodeRemarkListOfBeenSplited;
|
|
|
}
|
|
|
String strNodeRemark = "";
|
|
|
String imageNodeRemark = "";
|
|
|
int indx = nodeMark.indexOf(Util.getSeparator());
|
|
|
if (indx > -1) {
|
|
|
strNodeRemark = nodeMark.substring(0, indx);
|
|
|
imageNodeRemark = nodeMark.substring(indx + 1);
|
|
|
nodeMark = nodeMark.substring(indx + 1);
|
|
|
indx = nodeMark.indexOf("<br>");
|
|
|
if (indx > -1) {
|
|
|
imageNodeRemark = nodeMark.substring(0, indx);
|
|
|
nodeMark = nodeMark.substring(indx + 4);
|
|
|
HashMap nodeRemarkOfBeenSplitedMap = new HashMap();
|
|
|
nodeRemarkOfBeenSplitedMap.put("imageNodeRemark", imageNodeRemark);
|
|
|
nodeRemarkOfBeenSplitedMap.put("strNodeRemark", strNodeRemark);
|
|
|
nodeRemarkListOfBeenSplited.add(nodeRemarkOfBeenSplitedMap);
|
|
|
nodeRemarkListOfBeenSplited = getNodeRemarkListOfBeenSplited(nodeMark, nodeRemarkListOfBeenSplited);
|
|
|
} else {
|
|
|
HashMap nodeRemarkOfBeenSplitedMap = new HashMap();
|
|
|
nodeRemarkOfBeenSplitedMap.put("imageNodeRemark", imageNodeRemark);
|
|
|
nodeRemarkOfBeenSplitedMap.put("strNodeRemark", strNodeRemark);
|
|
|
nodeRemarkListOfBeenSplited.add(nodeRemarkOfBeenSplitedMap);
|
|
|
}
|
|
|
}
|
|
|
return nodeRemarkListOfBeenSplited;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得需要保存的主字段
|
|
|
*
|
|
|
* @param formid
|
|
|
* @param isbill
|
|
|
* @param workflowid
|
|
|
* @param nodeid
|
|
|
* @return
|
|
|
*/
|
|
|
public ArrayList getSaveMainFields(int formid, int isbill, int workflowid, int nodeid, ArrayList fieldids) {
|
|
|
fieldids = getEditMainFields(formid, isbill, workflowid, nodeid, fieldids);
|
|
|
fieldids = getManagerFields(formid, isbill, fieldids);
|
|
|
fieldids = getColcalFields(formid, fieldids);
|
|
|
fieldids = getTriggerFileds(workflowid, formid, isbill, fieldids);
|
|
|
fieldids = getHtmlAttrField(nodeid, fieldids);
|
|
|
fieldids = getViewAttrLinkageField(workflowid, nodeid, fieldids);
|
|
|
//add by wshen
|
|
|
fieldids = getSAPDetailField(formid, isbill, fieldids, 0);
|
|
|
//新版公式的赋值字段
|
|
|
fieldids = getFormulaNew(formid, isbill, workflowid, nodeid, fieldids);
|
|
|
if (getIsFreeNode(nodeid)) removeManagerFields(formid, isbill, fieldids);
|
|
|
return fieldids;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得是否为自由流程节点
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public boolean getIsFreeNode(int nodeid) {
|
|
|
boolean isFreeNode = false;
|
|
|
try {
|
|
|
RecordSet rs3 = new RecordSet();
|
|
|
rs3.execute("select IsFreeNode from workflow_nodebase where id=" + nodeid);
|
|
|
if (rs3.next()) {
|
|
|
String isFreeNode_temp = Util.null2String(rs3.getString("IsFreeNode"));
|
|
|
if (isFreeNode_temp.equals("1")) isFreeNode = true;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
}
|
|
|
return isFreeNode;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 清除表单manager字段
|
|
|
*
|
|
|
* @param formid
|
|
|
* @param isbill
|
|
|
* @param fieldids
|
|
|
* @return
|
|
|
*/
|
|
|
public ArrayList removeManagerFields(int formid, int isbill, ArrayList fieldids) {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String sql = "";
|
|
|
//表单
|
|
|
if (isbill == 0) {
|
|
|
sql = "select fieldid from workflow_formfield where formid=" + formid + " and (isdetail is null or isdetail !='1') and exists(select 1 from workflow_formdict where fieldname='manager' and workflow_formfield.fieldid=id) order by fieldid";
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
String fieldid = rs.getString("fieldid");
|
|
|
if (fieldids.indexOf(fieldid) > -1) fieldids.remove(fieldids.indexOf(fieldid));
|
|
|
}
|
|
|
}
|
|
|
//单据
|
|
|
if (isbill == 1) {
|
|
|
sql = "select id as fieldid from workflow_billfield where billid=" + formid + " and viewtype=0 and fieldname='manager' order by id";
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
String fieldid = rs.getString("fieldid");
|
|
|
if (fieldids.indexOf(fieldid) > -1) fieldids.remove(fieldids.indexOf(fieldid));
|
|
|
}
|
|
|
}
|
|
|
return fieldids;
|
|
|
}
|
|
|
|
|
|
public ArrayList getHtmlAttrField(int nodeid, ArrayList fieldids) {
|
|
|
try {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
rs.execute("select fieldid from workflow_nodefieldattr where nodeid=" + nodeid);
|
|
|
while (rs.next()) {
|
|
|
String fieldid = rs.getString("fieldid");
|
|
|
if (fieldids.indexOf(fieldid) == -1) {
|
|
|
fieldids.add(fieldid);
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
}
|
|
|
return fieldids;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 显示属性联动被修改字段允许入库
|
|
|
*/
|
|
|
public ArrayList getViewAttrLinkageField(int workflowid, int nodeid, ArrayList fieldids){
|
|
|
try{
|
|
|
RecordSet rs = new RecordSet();
|
|
|
rs.executeQuery("select changefieldids,viewattr from workflow_viewattrlinkage where workflowid=? and (nodeid=? or nodeid='-1')", workflowid,nodeid);
|
|
|
while(rs.next()){
|
|
|
List<String> changefieldlist = Util.TokenizerString(Util.null2String(rs.getString("changefieldids")), ",");
|
|
|
for(String changefield : changefieldlist){
|
|
|
String changefieldid = changefield.split("_")[0];
|
|
|
if(fieldids.indexOf(changefieldid) == -1)
|
|
|
fieldids.add(changefieldid);
|
|
|
}
|
|
|
}
|
|
|
}catch(Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return fieldids;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 手机端传的参数fieldids带有field开头
|
|
|
*/
|
|
|
public ArrayList getHtmlAttrField_mobile(int nodeid, ArrayList fieldids) {
|
|
|
try {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
rs.execute("select fieldid from workflow_nodefieldattr where nodeid=" + nodeid);
|
|
|
while (rs.next()) {
|
|
|
String fieldid = "field" + rs.getString("fieldid");
|
|
|
if (fieldids.indexOf(fieldid) == -1) {
|
|
|
fieldids.add(fieldid);
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
}
|
|
|
return fieldids;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得可以编辑的主字段id
|
|
|
*
|
|
|
* @param formid
|
|
|
* @param isbill
|
|
|
* @param workflowid
|
|
|
* @param nodeid
|
|
|
* @return
|
|
|
*/
|
|
|
public ArrayList getEditMainFields(int formid, int isbill, int workflowid, int nodeid, ArrayList fieldids) {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
RecordSet rs1 = new RecordSet();
|
|
|
String sql = "";
|
|
|
String ismode = "";
|
|
|
int modeid = 0;
|
|
|
int isform = 0;
|
|
|
int showdes = 0;
|
|
|
rs1.executeSql("select ismode,showdes from workflow_flownode where workflowid=" + workflowid + " and nodeid=" + nodeid);
|
|
|
if (rs1.next()) {
|
|
|
ismode = Util.null2String(rs1.getString("ismode"));
|
|
|
showdes = Util.getIntValue(Util.null2String(rs1.getString("showdes")), 0);
|
|
|
}
|
|
|
|
|
|
DoSaveFreeExcelDesignBiz doSaveFreeExcelDesignBiz = new DoSaveFreeExcelDesignBiz(user);
|
|
|
int configid = doSaveFreeExcelDesignBiz.getLayoutConfigId(this.Requestid);
|
|
|
boolean isnewFreelayout = DoSaveFreeExcelDesignBiz.judgeIsFreeCustomFormByRequestId(Requestid);
|
|
|
if(isnewFreelayout){
|
|
|
ismode= "2";
|
|
|
}
|
|
|
if (ismode.equals("1") && showdes != 1) {
|
|
|
rs1.executeSql("select id from workflow_nodemode where isprint='0' and workflowid=" + workflowid + " and nodeid=" + nodeid);
|
|
|
if (rs1.next()) {
|
|
|
modeid = rs1.getInt("id");
|
|
|
} else {
|
|
|
rs1.executeSql("select id from workflow_formmode where isprint='0' and formid=" + formid + " and isbill='" + isbill + "'");
|
|
|
if (rs1.next()) {
|
|
|
modeid = rs1.getInt("id");
|
|
|
isform = 1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//表单
|
|
|
if (isbill == 0) {
|
|
|
if (modeid > 0) {
|
|
|
if (isform == 1) {
|
|
|
sql = "select distinct fieldid from workflow_modeview where nodeid=0 and formid=" + formid + " and isbill=" + isbill + " and isedit='1' and exists(select 1 from workflow_formfield where formid=" + formid + " and (isdetail is null or isdetail !='1') and workflow_formfield.fieldid=workflow_modeview.fieldid) order by fieldid";
|
|
|
} else {
|
|
|
sql = "select distinct fieldid from workflow_modeview where nodeid=" + nodeid + " and formid=" + formid + " and isbill=" + isbill + " and isedit='1' and exists(select 1 from workflow_formfield where formid=" + formid + " and (isdetail is null or isdetail !='1') and workflow_formfield.fieldid=workflow_modeview.fieldid) order by fieldid";
|
|
|
}
|
|
|
} else {
|
|
|
sql = "select distinct fieldid from workflow_nodeform where nodeid=" + nodeid + " and isedit='1' and exists(select 1 from workflow_formfield where formid=" + formid + " and (isdetail is null or isdetail !='1') and workflow_formfield.fieldid=workflow_nodeform.fieldid) order by fieldid";
|
|
|
}
|
|
|
if(isnewFreelayout){
|
|
|
sql = "select distinct fieldid from workflow_freenode_nodeform where nodeid=" + nodeid + " and layoutconfigid = "+configid+" and isedit='1' and exists(select 1 from workflow_formfield where formid=" + formid + " and (isdetail is null or isdetail !='1') and workflow_formfield.fieldid=workflow_freenode_nodeform.fieldid) order by fieldid";
|
|
|
}
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
String fieldid = rs.getString("fieldid");
|
|
|
if (fieldids.indexOf(fieldid) == -1) fieldids.add(fieldid);
|
|
|
}
|
|
|
}
|
|
|
//单据
|
|
|
if (isbill == 1) {
|
|
|
if (modeid > 0) {
|
|
|
if (isform == 1) {
|
|
|
sql = "select distinct fieldid from workflow_modeview where nodeid=0 and formid=" + formid + " and isbill=" + isbill + " and isedit='1' and exists(select 1 from workflow_billfield where billid=" + formid + " and viewtype=0 and workflow_billfield.id=workflow_modeview.fieldid) order by fieldid";
|
|
|
} else {
|
|
|
sql = "select distinct fieldid from workflow_modeview where nodeid=" + nodeid + " and formid=" + formid + " and isbill=" + isbill + " and isedit='1' and exists(select 1 from workflow_billfield where billid=" + formid + " and viewtype=0 and workflow_billfield.id=workflow_modeview.fieldid) order by fieldid";
|
|
|
}
|
|
|
} else {
|
|
|
sql = "select distinct fieldid from workflow_nodeform where nodeid=" + nodeid + " and isedit='1' and exists(select 1 from workflow_billfield where billid=" + formid + " and viewtype=0 and workflow_billfield.id=workflow_nodeform.fieldid) order by fieldid";
|
|
|
}
|
|
|
if(isnewFreelayout){
|
|
|
sql = "select distinct fieldid from workflow_freenode_nodeform where nodeid=" + nodeid + " and layoutconfigid = "+configid+" and isedit='1' and exists(select 1 from workflow_billfield where billid=" + formid + " and viewtype=0 and workflow_billfield.id=workflow_freenode_nodeform.fieldid) order by fieldid";
|
|
|
}
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
String fieldid = rs.getString("fieldid");
|
|
|
if (fieldids.indexOf(fieldid) == -1) fieldids.add(fieldid);
|
|
|
}
|
|
|
}
|
|
|
return fieldids;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得表单列规则主字段
|
|
|
*
|
|
|
* @param formid
|
|
|
* @param fieldids
|
|
|
* @return
|
|
|
*/
|
|
|
public ArrayList getColcalFields(int formid, ArrayList fieldids) {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String sql = "select maincalstr from workflow_formdetailinfo where formid=" + formid;
|
|
|
rs.executeSql(sql);
|
|
|
if (rs.next()) {
|
|
|
String maincalstr = Util.null2String(rs.getString("maincalstr"));
|
|
|
ArrayList maincalstrlist = Util.TokenizerString(maincalstr, ";");
|
|
|
for (int i = 0; i < maincalstrlist.size(); i++) {
|
|
|
String tempcal = (String) maincalstrlist.get(i);
|
|
|
int indx = tempcal.indexOf("mainfield_");
|
|
|
int indx1 = tempcal.indexOf("=");
|
|
|
if (indx != -1 && indx1 != -1 && indx1 > indx) {
|
|
|
tempcal = tempcal.substring(indx + 10, indx1);
|
|
|
if (fieldids.indexOf(tempcal) == -1) fieldids.add(tempcal);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return fieldids;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得字段联动赋值主字段
|
|
|
*
|
|
|
* @param workflowid
|
|
|
* @param formid
|
|
|
* @param isbill
|
|
|
* @param fieldids
|
|
|
* @return
|
|
|
*/
|
|
|
public ArrayList getTriggerFileds(int workflowid, int formid, int isbill, ArrayList fieldids) {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String fieldidstr = "";
|
|
|
String sql = "select pagefieldname from Workflow_DataInput_field a where type=2 and exists(select 1 from Workflow_DataInput_main b where a.datainputid=b.id and exists(select 1 from Workflow_DataInput_entry c where b.entryid=c.id and c.workflowid=" + workflowid + "))";
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
String fieldname = Util.null2String(rs.getString("pagefieldname"));
|
|
|
int indx = fieldname.indexOf("field");
|
|
|
if (indx != -1 && fieldname.length() > 5) {
|
|
|
if (fieldidstr.equals("")) {
|
|
|
fieldidstr = fieldname.substring(5);
|
|
|
} else {
|
|
|
fieldidstr += "," + fieldname.substring(5);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (!fieldidstr.equals("")) {
|
|
|
if (isbill == 1) {
|
|
|
sql = "select id as fieldid from workflow_billfield where billid=" + formid + " and viewtype=0 and id in(" + fieldidstr + ") order by id";
|
|
|
} else {
|
|
|
sql = "select fieldid from workflow_formfield where formid=" + formid + " and (isdetail is null or isdetail !='1') and fieldid in(" + fieldidstr + ") order by fieldid";
|
|
|
}
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
String tempfieldid = rs.getString("fieldid");
|
|
|
if (fieldids.indexOf(tempfieldid) == -1) fieldids.add(tempfieldid);
|
|
|
}
|
|
|
}
|
|
|
return fieldids;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得表单manager字段
|
|
|
*
|
|
|
* @param formid
|
|
|
* @param isbill
|
|
|
* @param fieldids
|
|
|
* @return
|
|
|
*/
|
|
|
public ArrayList getManagerFields(int formid, int isbill, ArrayList fieldids) {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String sql = "";
|
|
|
//表单
|
|
|
if (isbill == 0) {
|
|
|
sql = "select fieldid from workflow_formfield where formid=" + formid + " and (isdetail is null or isdetail !='1') and exists(select 1 from workflow_formdict where fieldname='manager' and workflow_formfield.fieldid=id) order by fieldid";
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
String fieldid = rs.getString("fieldid");
|
|
|
if (fieldids.indexOf(fieldid) == -1) fieldids.add(fieldid);
|
|
|
}
|
|
|
}
|
|
|
//单据
|
|
|
if (isbill == 1) {
|
|
|
sql = "select id as fieldid from workflow_billfield where billid=" + formid + " and viewtype=0 and fieldname='manager' order by id";
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
String fieldid = rs.getString("fieldid");
|
|
|
if (fieldids.indexOf(fieldid) == -1) fieldids.add(fieldid);
|
|
|
}
|
|
|
}
|
|
|
return fieldids;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得需要保存的明细字段
|
|
|
*
|
|
|
* @param formid
|
|
|
* @param isbill
|
|
|
* @param workflowid
|
|
|
* @param nodeid
|
|
|
* @return
|
|
|
*/
|
|
|
public ArrayList getSaveDetailFields(int formid, int isbill, int workflowid, int nodeid, ArrayList fieldids) {
|
|
|
fieldids = getEditDetailFields(formid, isbill, workflowid, nodeid, fieldids);
|
|
|
fieldids = getRowcalFields(formid, fieldids);
|
|
|
fieldids = getTriggerDetailFileds(workflowid, formid, isbill, fieldids);
|
|
|
fieldids = getHtmlAttrField(nodeid, fieldids);
|
|
|
fieldids = getViewAttrLinkageField(workflowid, nodeid, fieldids);
|
|
|
//add by wshen
|
|
|
fieldids = getSAPDetailField(formid, isbill, fieldids, 1);
|
|
|
//新版公式的赋值字段
|
|
|
fieldids = getFormulaNew(formid, isbill, workflowid, nodeid, fieldids);
|
|
|
return fieldids;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得可以编辑的明细字段id
|
|
|
*
|
|
|
* @param formid
|
|
|
* @param isbill
|
|
|
* @param workflowid
|
|
|
* @param nodeid
|
|
|
* @return
|
|
|
*/
|
|
|
public ArrayList getEditDetailFields(int formid, int isbill, int workflowid, int nodeid, ArrayList fieldids) {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
RecordSet rs1 = new RecordSet();
|
|
|
String sql = "";
|
|
|
String ismode = "";
|
|
|
int modeid = 0;
|
|
|
int isform = 0;
|
|
|
int showdes = 0;
|
|
|
rs1.executeSql("select ismode,showdes from workflow_flownode where workflowid=" + workflowid + " and nodeid=" + nodeid);
|
|
|
if (rs1.next()) {
|
|
|
ismode = Util.null2String(rs1.getString("ismode"));
|
|
|
showdes = Util.getIntValue(Util.null2String(rs1.getString("showdes")), 0);
|
|
|
}
|
|
|
|
|
|
DoSaveFreeExcelDesignBiz doSaveFreeExcelDesignBiz = new DoSaveFreeExcelDesignBiz(user);
|
|
|
int configid = doSaveFreeExcelDesignBiz.getLayoutConfigId(this.Requestid);
|
|
|
boolean isnewFreelayout = DoSaveFreeExcelDesignBiz.judgeIsFreeCustomFormByRequestId(Requestid);
|
|
|
if(isnewFreelayout){
|
|
|
ismode= "2";
|
|
|
}
|
|
|
|
|
|
if (ismode.equals("1") && showdes != 1) {
|
|
|
rs1.executeSql("select id from workflow_nodemode where isprint='0' and workflowid=" + workflowid + " and nodeid=" + nodeid);
|
|
|
if (rs1.next()) {
|
|
|
modeid = rs1.getInt("id");
|
|
|
} else {
|
|
|
rs1.executeSql("select id from workflow_formmode where isprint='0' and formid=" + formid + " and isbill='" + isbill + "'");
|
|
|
if (rs1.next()) {
|
|
|
modeid = rs1.getInt("id");
|
|
|
isform = 1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//表单
|
|
|
if (isbill == 0) {
|
|
|
if (modeid > 0) {
|
|
|
if (isform == 1) {
|
|
|
sql = "select distinct fieldid from workflow_modeview where nodeid=0 and formid=" + formid + " and isbill=" + isbill + " and isedit='1' and exists(select 1 from workflow_formfield where formid=" + formid + " and isdetail ='1' and workflow_formfield.fieldid=workflow_modeview.fieldid) order by fieldid";
|
|
|
} else {
|
|
|
sql = "select distinct fieldid from workflow_modeview where nodeid=" + nodeid + " and formid=" + formid + " and isbill=" + isbill + " and isedit='1' and exists(select 1 from workflow_formfield where formid=" + formid + " and isdetail ='1' and workflow_formfield.fieldid=workflow_modeview.fieldid) order by fieldid";
|
|
|
}
|
|
|
} else {
|
|
|
sql = "select distinct fieldid from workflow_nodeform where nodeid=" + nodeid + " and isedit='1' and exists(select 1 from workflow_formfield where formid=" + formid + " and isdetail ='1' and workflow_formfield.fieldid=workflow_nodeform.fieldid) order by fieldid";
|
|
|
}
|
|
|
if(isnewFreelayout){
|
|
|
sql = "select distinct fieldid from workflow_freenode_nodeform where nodeid=" + nodeid + " and layoutconfigid = "+configid+" and isedit='1' and exists(select 1 from workflow_formfield where formid=" + formid + " and isdetail ='1' and workflow_formfield.fieldid=workflow_freenode_nodeform.fieldid) order by fieldid";
|
|
|
}
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
String fieldid = rs.getString("fieldid");
|
|
|
if (fieldids.indexOf(fieldid) == -1) fieldids.add(fieldid);
|
|
|
}
|
|
|
}
|
|
|
//单据
|
|
|
if (isbill == 1) {
|
|
|
if (modeid > 0) {
|
|
|
if (isform == 1) {
|
|
|
sql = "select distinct fieldid from workflow_modeview where nodeid=0 and formid=" + formid + " and isbill=" + isbill + " and isedit='1' and exists(select 1 from workflow_billfield where billid=" + formid + " and viewtype=1 and workflow_billfield.id=workflow_modeview.fieldid) order by fieldid";
|
|
|
} else {
|
|
|
sql = "select distinct fieldid from workflow_modeview where nodeid=" + nodeid + " and formid=" + formid + " and isbill=" + isbill + " and isedit='1' and exists(select 1 from workflow_billfield where billid=" + formid + " and viewtype=1 and workflow_billfield.id=workflow_modeview.fieldid) order by fieldid";
|
|
|
}
|
|
|
} else {
|
|
|
sql = "select distinct fieldid from workflow_nodeform where nodeid=" + nodeid + " and isedit='1' and exists(select 1 from workflow_billfield where billid=" + formid + " and viewtype=1 and workflow_billfield.id=workflow_nodeform.fieldid) order by fieldid";
|
|
|
}
|
|
|
if(isnewFreelayout){
|
|
|
sql = "select distinct fieldid from workflow_freenode_nodeform where nodeid=" + nodeid + " and layoutconfigid = "+configid+" and isedit='1' and exists(select 1 from workflow_billfield where billid=" + formid + " and viewtype=1 and workflow_billfield.id=workflow_freenode_nodeform.fieldid) order by fieldid";
|
|
|
}
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
String fieldid = rs.getString("fieldid");
|
|
|
if (fieldids.indexOf(fieldid) == -1) fieldids.add(fieldid);
|
|
|
}
|
|
|
}
|
|
|
return fieldids;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得表单行规则明细字段
|
|
|
*
|
|
|
* @param formid
|
|
|
* @param fieldids
|
|
|
* @return
|
|
|
*/
|
|
|
public ArrayList getRowcalFields(int formid, ArrayList fieldids) {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String sql = "select rowcalstr from workflow_formdetailinfo where formid=" + formid;
|
|
|
rs.executeSql(sql);
|
|
|
if (rs.next()) {
|
|
|
String rowcalstr = Util.null2String(rs.getString("rowcalstr"));
|
|
|
ArrayList rowcalstrlist = Util.TokenizerString(rowcalstr, ";");
|
|
|
for (int i = 0; i < rowcalstrlist.size(); i++) {
|
|
|
String tempcal = (String) rowcalstrlist.get(i);
|
|
|
int indx = tempcal.indexOf("detailfield_");
|
|
|
int indx1 = tempcal.indexOf("=");
|
|
|
if (indx != -1 && indx1 != -1 && indx1 > indx) {
|
|
|
tempcal = tempcal.substring(indx + 12, indx1);
|
|
|
if (fieldids.indexOf(tempcal) == -1) fieldids.add(tempcal);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return fieldids;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得字段联动赋值明细字段
|
|
|
*
|
|
|
* @param workflowid
|
|
|
* @param formid
|
|
|
* @param isbill
|
|
|
* @param fieldids
|
|
|
* @return
|
|
|
*/
|
|
|
public ArrayList getTriggerDetailFileds(int workflowid, int formid, int isbill, ArrayList fieldids) {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String fieldidstr = "";
|
|
|
String sql = "select pagefieldname from Workflow_DataInput_field a where type=2 and exists(select 1 from Workflow_DataInput_main b where a.datainputid=b.id and exists(select 1 from Workflow_DataInput_entry c where b.entryid=c.id and c.workflowid=" + workflowid + "))";
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
String fieldname = Util.null2String(rs.getString("pagefieldname"));
|
|
|
int indx = fieldname.indexOf("field");
|
|
|
if (indx != -1 && fieldname.length() > 5) {
|
|
|
if (fieldidstr.equals("")) {
|
|
|
fieldidstr = fieldname.substring(5);
|
|
|
} else {
|
|
|
fieldidstr += "," + fieldname.substring(5);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (!fieldidstr.equals("")) {
|
|
|
if (isbill == 1) {
|
|
|
sql = "select id as fieldid from workflow_billfield where billid=" + formid + " and viewtype=1 and id in(" + fieldidstr + ") order by id";
|
|
|
} else {
|
|
|
sql = "select fieldid from workflow_formfield where formid=" + formid + " and isdetail ='1' and fieldid in(" + fieldidstr + ") order by fieldid";
|
|
|
}
|
|
|
rs.executeSql(sql);
|
|
|
while (rs.next()) {
|
|
|
String tempfieldid = rs.getString("fieldid");
|
|
|
if (fieldids.indexOf(tempfieldid) == -1) fieldids.add(tempfieldid);
|
|
|
}
|
|
|
}
|
|
|
return fieldids;
|
|
|
}
|
|
|
|
|
|
public ArrayList getManTableChildFields() {
|
|
|
return ManTableChildFields;
|
|
|
}
|
|
|
|
|
|
public void setManTableChildFields(ArrayList manTableChildFields) {
|
|
|
ManTableChildFields = manTableChildFields;
|
|
|
}
|
|
|
|
|
|
public ArrayList getDetailTableChildFields() {
|
|
|
return DetailTableChildFields;
|
|
|
}
|
|
|
|
|
|
public void setDetailTableChildFields(ArrayList detailTableChildFields) {
|
|
|
DetailTableChildFields = detailTableChildFields;
|
|
|
}
|
|
|
|
|
|
public String getIswfshare() {
|
|
|
return iswfshare;
|
|
|
}
|
|
|
|
|
|
public void setIswfshare(String iswfshare) {
|
|
|
this.iswfshare = iswfshare;
|
|
|
}
|
|
|
|
|
|
private String getHr() {
|
|
|
BaseBean bb = getWfsbean();
|
|
|
int showdotted = Util.getIntValue(bb.getPropValue("WFShowDotted", "showdotted"), 0);
|
|
|
String hr = "";
|
|
|
if (showdotted == 1) {
|
|
|
hr = bb.getPropValue("WFShowDotted", "hr");
|
|
|
try {
|
|
|
hr = new String(hr.getBytes("ISO-8859-1"), "UTF-8").trim();
|
|
|
Pattern p_script;
|
|
|
Matcher m_script;
|
|
|
String regEx_script = "<[\\s]*?script[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?script[\\s]*?>"; // 定义script的正则表达式{或<script[^>]*?>[\\s\\S]*?<\\/script>
|
|
|
p_script = Pattern.compile(regEx_script, Pattern.CASE_INSENSITIVE);
|
|
|
m_script = p_script.matcher(hr);
|
|
|
hr = m_script.replaceAll(""); // 过滤script标签
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
if ("".equals(hr)) { // 如果为空,显示默认分隔符
|
|
|
// 颜色
|
|
|
String color = bb.getPropValue("WFShowDotted", "color");
|
|
|
String colorStr = "black";
|
|
|
if ("1".equals(color)) {
|
|
|
colorStr = "black";
|
|
|
} else if ("2".equals(color)) {
|
|
|
colorStr = "blue";
|
|
|
} else if ("3".equals(color)) {
|
|
|
colorStr = "red";
|
|
|
} else if ("4".equals(color)) {
|
|
|
colorStr = "yellow";
|
|
|
} else if ("5".equals(color)) {
|
|
|
colorStr = "green";
|
|
|
} else if ("6".equals(color)) {
|
|
|
colorStr = "gray";
|
|
|
}
|
|
|
|
|
|
// 线型
|
|
|
String style = bb.getPropValue("WFShowDotted", "style");
|
|
|
String styleStr = "dotted";
|
|
|
if ("1".equals(style)) {
|
|
|
styleStr = "dotted";
|
|
|
} else if ("2".equals(style)) {
|
|
|
styleStr = "dashed";
|
|
|
} else if ("3".equals(style)) {
|
|
|
styleStr = "solid";
|
|
|
}
|
|
|
|
|
|
// 长度
|
|
|
int length = Util.getIntValue(bb.getPropValue("WFShowDotted", "length"), 60);
|
|
|
if (length < 0) {
|
|
|
length = 60;
|
|
|
}
|
|
|
|
|
|
hr = "<div size=\"1\" style=\"text-align:left;border:1px " + styleStr + ";color:" + colorStr + ";width:" + length + "%;\" ></div>";
|
|
|
}
|
|
|
} else {
|
|
|
hr = "<br>";
|
|
|
}
|
|
|
|
|
|
return hr;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据明细表下标和列下标取得filedid
|
|
|
*
|
|
|
* @param tableIndex
|
|
|
* @param colIndex
|
|
|
* @return
|
|
|
*/
|
|
|
public String getDetailTableField(int tableIndex, int colIndex) {
|
|
|
return (String) ((List) this.getDetailTableFields().get(tableIndex)).get(colIndex);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 取得明细字段值
|
|
|
*
|
|
|
* @param tableIndex
|
|
|
* @param rowIndex
|
|
|
* @param colIndex
|
|
|
* @return
|
|
|
*/
|
|
|
public String getFiledValue(int tableIndex, int rowIndex, int colIndex) {
|
|
|
String detailTableField = this.getDetailTableField(tableIndex, colIndex);
|
|
|
String fieldId = ((String) Util.TokenizerString((String) detailTableField, "_").get(0)).substring(5);
|
|
|
return ((Map<String, String>) ((List) this.getDetailFieldValues().get(tableIndex)).get(rowIndex)).get(fieldId);
|
|
|
}
|
|
|
|
|
|
public int getRowSize(int tableIndex) {
|
|
|
return ((List) this.getDetailFieldValues().get(tableIndex)).size();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 得到导出值
|
|
|
*
|
|
|
* @param tableIndex
|
|
|
* @param rowIndex
|
|
|
* @param colIndex
|
|
|
* @return
|
|
|
*/
|
|
|
public String getFieldExportCellValue(FieldInfo fi1, int tableIndex, int rowIndex, int colIndex) {
|
|
|
FnaSystemSetComInfo fnaSystemSetComInfo = new FnaSystemSetComInfo();
|
|
|
int wfDtlImpRole4Subject = Util.getIntValue(fnaSystemSetComInfo.get_wfDtlImpRole4Subject(), 0);//科目字段流程明细导入规则
|
|
|
int wfDtlImpRole4Fcc = Util.getIntValue(fnaSystemSetComInfo.get_wfDtlImpRole4Fcc(), 0);//成本中心字段流程明细导入规则
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String filedValue = this.getFiledValue(tableIndex, rowIndex, colIndex);
|
|
|
if (!"".equals(filedValue)) {
|
|
|
filedValue = filedValue.replace("'", "''");
|
|
|
boolean isnull = false;
|
|
|
ArrayList tempfields = Util.TokenizerString(this.getDetailTableField(tableIndex, colIndex), "_");
|
|
|
int type = Util.getIntValue((String) tempfields.get(2));
|
|
|
int htmltype = Util.getIntValue((String) tempfields.get(3));
|
|
|
switch (htmltype) {
|
|
|
case 1:
|
|
|
case 2:
|
|
|
filedValue = filedValue.replace("<br>","\n");
|
|
|
break;
|
|
|
case 3:
|
|
|
if (type == 22 && wfDtlImpRole4Subject == 1) {//科目浏览按钮 && 开启了科目按编码导入
|
|
|
BudgetfeeTypeComInfo budgetfeeTypeComInfo = new BudgetfeeTypeComInfo();
|
|
|
filedValue = Util.null2String(budgetfeeTypeComInfo.getBudgetfeeTypeCodeName(String.valueOf(Util.getIntValue(filedValue.replace("'", ""))))).trim();
|
|
|
} else if (type == 22 && wfDtlImpRole4Subject == 2) {//科目浏览按钮 && 开启了科目按全路径名称导入
|
|
|
BudgetfeeTypeComInfo budgetfeeTypeComInfo = new BudgetfeeTypeComInfo();
|
|
|
filedValue = budgetfeeTypeComInfo.getSubjectFullName(String.valueOf(Util.getIntValue(filedValue.replace("'", "")))).trim();
|
|
|
} else if (type == 251 && wfDtlImpRole4Fcc == 1) {//成本中心浏览按钮 && 开启了成本中心按编码导入
|
|
|
RecordSet rs1 = new RecordSet();
|
|
|
rs1.executeQuery("select a.id, a.name, a.code from FnaCostCenter a where a.id = " + Util.getIntValue(filedValue.replace("'", "")));
|
|
|
if (rs1.next()) {
|
|
|
filedValue = Util.null2String(rs1.getString("code")).trim();
|
|
|
} else {
|
|
|
filedValue = "";
|
|
|
}
|
|
|
} else if (type == 251 && wfDtlImpRole4Fcc == 2) {//成本中心浏览按钮 && 开启了成本中心按全路径名称导入
|
|
|
filedValue = RequestDetailImportUtil.getCostCenterFullName(filedValue.replace("'", ""));
|
|
|
} else {
|
|
|
String fieldDBType = (String) ((List) fi1.getDetailFieldDBTypes().get(tableIndex)).get(colIndex);
|
|
|
Map<String,Object> otherparams = new HashMap<>();
|
|
|
otherparams.put("rowIndex", rowIndex);
|
|
|
filedValue = this.getFieldName(filedValue, type, fieldDBType, otherparams);
|
|
|
}
|
|
|
break;
|
|
|
case 4:
|
|
|
if ("1".equals(filedValue)) {
|
|
|
filedValue = SystemEnv.getHtmlLabelName(25104, user.getLanguage());
|
|
|
} else {
|
|
|
filedValue = "";
|
|
|
}
|
|
|
break;
|
|
|
case 5:
|
|
|
//复选框可以选择多个字段
|
|
|
if (type == 2) {
|
|
|
//整理已选择的值
|
|
|
String[] valueList = Util.TokenizerString2(filedValue, ",");
|
|
|
String totalvalue = "";
|
|
|
for (String value : valueList) {
|
|
|
if (!value.equals("")) {
|
|
|
totalvalue += "," + value;
|
|
|
}
|
|
|
}
|
|
|
if (totalvalue.length() > 0) {
|
|
|
String tempvalue = "";
|
|
|
totalvalue = totalvalue.substring(1);
|
|
|
|
|
|
rs.executeSql("SELECT selectname FROM workflow_selectitem WHERE selectvalue in(" + totalvalue + ") AND fieldid=" + ((String) tempfields.get(0)).substring(5));
|
|
|
while (rs.next()) {
|
|
|
tempvalue += "," + Util.null2String(rs.getString("selectname"));
|
|
|
}
|
|
|
if (tempvalue.startsWith(",")) tempvalue = tempvalue.substring(1);
|
|
|
filedValue = tempvalue;
|
|
|
} else {
|
|
|
filedValue = "";
|
|
|
}
|
|
|
} else {
|
|
|
rs.executeSql("SELECT selectname FROM workflow_selectitem WHERE selectvalue='" + filedValue + "' AND fieldid=" + ((String) tempfields.get(0)).substring(5));
|
|
|
if (rs.next()) {
|
|
|
filedValue = Util.null2String(rs.getString("selectname"));
|
|
|
} else {
|
|
|
filedValue = "";
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
return filedValue;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得SAP中明细表字段id
|
|
|
*
|
|
|
* @param formid
|
|
|
* @param isbill
|
|
|
* @param fieldids
|
|
|
* @param formType 1为明细表 ,0 为主表
|
|
|
* @return
|
|
|
* @author wshen
|
|
|
*/
|
|
|
private ArrayList getSAPDetailField(int formid, int isbill, ArrayList fieldids, int formType) {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String sql = "";
|
|
|
//处理输出表
|
|
|
sql = "select fromfieldid from sap_outTable where isbill=" + isbill + " and fromfieldid in (select id from workflow_billfield where billid =" + formid + " and viewtype=" + formType + ")";
|
|
|
rs.execute(sql);
|
|
|
while (rs.next()) {
|
|
|
String fieldid = rs.getString("fromfieldid");
|
|
|
if (fieldids.indexOf(fieldid) == -1) fieldids.add(fieldid);
|
|
|
}
|
|
|
//处理输出参数
|
|
|
sql = "select fromfieldid from sap_outParameter where isbill=" + isbill + " and fromfieldid in (select id from workflow_billfield where billid =" + formid + " and viewtype=" + formType + ")";
|
|
|
rs.execute(sql);
|
|
|
while (rs.next()) {
|
|
|
String fieldid = rs.getString("fromfieldid");
|
|
|
if (fieldids.indexOf(fieldid) == -1) fieldids.add(fieldid);
|
|
|
}
|
|
|
//处理输出结构
|
|
|
sql = "select fromfieldid from sap_outStructure where isbill=" + isbill + " and fromfieldid in (select id from workflow_billfield where billid =" + formid + " and viewtype=" + formType + ")";
|
|
|
rs.execute(sql);
|
|
|
while (rs.next()) {
|
|
|
String fieldid = rs.getString("fromfieldid");
|
|
|
if (fieldids.indexOf(fieldid) == -1) fieldids.add(fieldid);
|
|
|
}
|
|
|
//处理输入参数
|
|
|
sql = "select fromfieldid from sap_inParameter where isbill=" + isbill + " and fromfieldid in (select id from workflow_billfield where billid =" + formid + " and viewtype=" + formType + ")";
|
|
|
rs.execute(sql);
|
|
|
while (rs.next()) {
|
|
|
String fieldid = rs.getString("fromfieldid");
|
|
|
if (fieldids.indexOf(fieldid) == -1) fieldids.add(fieldid);
|
|
|
}
|
|
|
//处理输入结构
|
|
|
sql = "select fromfieldid from sap_inStructure where isbill=" + isbill + " and fromfieldid in (select id from workflow_billfield where billid =" + formid + " and viewtype=" + formType + ")";
|
|
|
rs.execute(sql);
|
|
|
while (rs.next()) {
|
|
|
String fieldid = rs.getString("fromfieldid");
|
|
|
if (fieldids.indexOf(fieldid) == -1) fieldids.add(fieldid);
|
|
|
}
|
|
|
//处理输入表
|
|
|
sql = "select fromfieldid from sap_inTable where isbill=" + isbill + " and fromfieldid in (select id from workflow_billfield where billid =" + formid + " and viewtype=" + formType + ")";
|
|
|
rs.execute(sql);
|
|
|
while (rs.next()) {
|
|
|
String fieldid = rs.getString("fromfieldid");
|
|
|
if (fieldids.indexOf(fieldid) == -1) fieldids.add(fieldid);
|
|
|
}
|
|
|
return fieldids;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得新版公式赋值字段id
|
|
|
* @param formid
|
|
|
* @param isbill
|
|
|
* @param workflowid
|
|
|
* @param nodeid
|
|
|
* @param fieldids
|
|
|
* @return
|
|
|
*/
|
|
|
private ArrayList getFormulaNew(int formid, int isbill, int workflowid, int nodeid, ArrayList fieldids) {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String sql = "";
|
|
|
//处理输出表
|
|
|
sql = "select destcell,formula from workflow_formula_htmllayout where formid= ? and isbill = ? and workflowid = ? and nodeid = ?";
|
|
|
rs.executeQuery(sql, formid, isbill, workflowid, nodeid);
|
|
|
JSONArray arr;
|
|
|
String fieldid;
|
|
|
while (rs.next()) {
|
|
|
//["main.34403","main.34408"]
|
|
|
String destcell = rs.getString("destcell");
|
|
|
arr = JSONArray.parseArray(destcell);
|
|
|
for (int i = 0 ; arr != null && i < arr.size(); i++) {
|
|
|
fieldid = arr.getString(i);
|
|
|
if (fieldid.indexOf(".") > -1) {
|
|
|
fieldid = fieldid.split("\\.")[1];
|
|
|
if (fieldids.indexOf(fieldid) == -1)
|
|
|
fieldids.add(fieldid);
|
|
|
}
|
|
|
}
|
|
|
//处理写在IF公式内部的赋值字段
|
|
|
String formula = rs.getString("formula");
|
|
|
//formula: IF([main.652248]==10,[main.652247]=5,[main.652249]=0) destcell: [""]
|
|
|
if((arr != null && arr.size() == 1) && formula.contains("IF")){
|
|
|
String pattern ="\\[([a-zA-Z0-9]|\\.)+\\](?<!=)=(?!=)";
|
|
|
Pattern r = Pattern.compile(pattern);
|
|
|
Matcher m = r.matcher(formula);
|
|
|
fieldid = "";
|
|
|
while (m.find( )) {
|
|
|
//[main.652247]=
|
|
|
String match = m.group();
|
|
|
if (match.indexOf(".") > -1) {
|
|
|
String fieldStr= match.split("\\.")[1];
|
|
|
if (fieldStr.length() > 2)
|
|
|
fieldid = fieldStr.substring(0,fieldStr.length()-2);
|
|
|
if (fieldids.indexOf(fieldid) == -1)
|
|
|
fieldids.add(fieldid);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
return fieldids;
|
|
|
}
|
|
|
|
|
|
private Map<Integer, String> getFreeNodeName(int requestId) {
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String basesql = "select id,nodeName from workflow_freenode ";
|
|
|
if("".equals(this.mainSubSignEntity.getRequestids())){
|
|
|
rs.executeQuery(basesql + " where requestid = ?", requestId);
|
|
|
}else{
|
|
|
String requestidStr = requestId+","+this.mainSubSignEntity.getRequestids();
|
|
|
rs.executeQuery(basesql + " where " + Util.getSubINClause(requestidStr, "requestid", "IN"));
|
|
|
}
|
|
|
Map<Integer, String> nodeNameMap = new HashMap<>();
|
|
|
while (rs.next()) {
|
|
|
Integer nodeId = rs.getInt("id");
|
|
|
nodeNameMap.put(nodeId, rs.getString("nodeName"));
|
|
|
}
|
|
|
return nodeNameMap;
|
|
|
}
|
|
|
|
|
|
//处理默认签字意见大小的外层div,防止签字意见独占一行的情况
|
|
|
private String processDefaultFontSizeDiv(String remark) {
|
|
|
String indexStr = "<div id=\"wea_rich_text_default_font\"";
|
|
|
if (Util.null2String(remark).indexOf(indexStr) > -1) {
|
|
|
remark = remark.replace(indexStr,"<span id=\"wea_rich_text_default_font\"");
|
|
|
if(remark.endsWith("</div>")) {
|
|
|
remark = remark.substring(0, remark.length() - 6);
|
|
|
remark += "</span>";
|
|
|
}
|
|
|
}
|
|
|
indexStr = "<div id=\"ck_rich_text_default_font\"";
|
|
|
if (Util.null2String(remark).indexOf(indexStr) > -1) {
|
|
|
remark = remark.replace(indexStr,"<span id=\"ck_rich_text_default_font\"");
|
|
|
if(remark.endsWith("</div>")) {
|
|
|
remark = remark.substring(0, remark.length() - 6);
|
|
|
remark += "</span>";
|
|
|
}
|
|
|
}
|
|
|
return remark;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 签字意见添加全文批注
|
|
|
* @param remark
|
|
|
* @param fullTextAnnotation
|
|
|
* @return
|
|
|
*/
|
|
|
private String appendFullTextAnnotation(String remark, String fullTextAnnotation) {
|
|
|
if (!"".equals(fullTextAnnotation)) {
|
|
|
String[] fulltextannotationIds = Util.splitString(fullTextAnnotation, ",");
|
|
|
for (String fulltextannotationId : fulltextannotationIds) {
|
|
|
int __fulltextannoationid = Util.getIntValue(fulltextannotationId);
|
|
|
if (__fulltextannoationid <= 0) continue;
|
|
|
remark += "<BR/><img name=\"fulltextannotation\" src=\""+weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fileid=" + __fulltextannoationid + "\" />";
|
|
|
}
|
|
|
}
|
|
|
return remark;
|
|
|
}
|
|
|
|
|
|
public List<Integer> remarksort(List<Map<String,String>> remarkList_date,int groupOrderType) {
|
|
|
List<Integer> remarkKeys = new ArrayList<>();
|
|
|
if(groupOrderType==2){
|
|
|
Collections.sort(remarkList_date ,new Comparator<Map<String,String>>() {
|
|
|
@Override
|
|
|
public int compare(Map<String,String> m1, Map<String,String> m2) {
|
|
|
return m1.get(m1.keySet().iterator().next()).compareTo(m2.get(m2.keySet().iterator().next()));
|
|
|
}
|
|
|
});
|
|
|
}else{
|
|
|
Collections.sort(remarkList_date ,new Comparator<Map<String,String>>() {
|
|
|
@Override
|
|
|
public int compare(Map<String,String> m1, Map<String,String> m2) {
|
|
|
return m2.get(m2.keySet().iterator().next()).compareTo(m1.get(m1.keySet().iterator().next()));
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
for(Map<String,String> date:remarkList_date){
|
|
|
int key = Util.getIntValue(date.keySet().iterator().next());
|
|
|
if(!remarkKeys.contains(key)){
|
|
|
remarkKeys.add(key);
|
|
|
}
|
|
|
}
|
|
|
return remarkKeys;
|
|
|
}
|
|
|
|
|
|
//qc1642534 获取自由节点的签字意见 异步加载
|
|
|
public String GetfreeNodeRemark1(int workflowid, int currentnodeid, int ismode,NodeSignInputSetEntity entity,int requestid,String markKey) {
|
|
|
this.markkey = markKey+"_"+workflowid;//qc1679821
|
|
|
new Thread(new Runnable(){
|
|
|
@Override
|
|
|
public void run(){
|
|
|
// if (ismode == 1) //本需求这里ismode固定为2
|
|
|
// ismode = 0;
|
|
|
|
|
|
//-9999表示自由节点
|
|
|
String nodemark = GetNodeRemarkInner(workflowid, -9999, currentnodeid, 2,entity);
|
|
|
nodemark = checkNodemark(nodemark);
|
|
|
RecordSet rs = new RecordSet();
|
|
|
rs.executeUpdate("update qc1642534_temp set markcontent = ? where requestid = ? and cellmark = ?",nodemark,requestid,markKey);
|
|
|
}
|
|
|
}).start();
|
|
|
return "<div id='"+markKey+"'><div>";
|
|
|
}
|
|
|
|
|
|
//qc1642534 获取节点的签字意见 异步加载
|
|
|
public String GetNodeRemark1(int workflowid, int nodeid, int currentnodeid, int ismode, NodeSignInputSetEntity entity,int requestid,String markKey) {
|
|
|
this.markkey = markKey+"_"+workflowid;//qc1679821
|
|
|
try {
|
|
|
new Thread(new Runnable(){
|
|
|
@Override
|
|
|
public void run(){
|
|
|
String nodemark = GetNodeRemarkInner(workflowid, nodeid, currentnodeid, ismode,entity);
|
|
|
nodemark = checkNodemark(nodemark);
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
rs.writeLog(">>>qc1642534 :requestid="+requestid+",markKey="+markKey+"获取节点签字意见:"+nodemark);
|
|
|
rs.executeUpdate("update qc1642534_temp set markcontent = ? where requestid = ? and cellmark = ?",nodemark,requestid,markKey);
|
|
|
}
|
|
|
}).start();
|
|
|
return "<div id='"+markKey+"'><div>";
|
|
|
} catch (Exception e) {
|
|
|
log.info("Catch a exception.", e);
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//qc1679821 是否是要折叠的流程 如果是 就设置markkey和needHide属性
|
|
|
public void initNeedHide(int workflowid,String efieldid,String markkey){
|
|
|
RecordSet rs = new RecordSet();
|
|
|
String wfid = workflowid+"";
|
|
|
rs.executeQuery("select * from uf_fieldremark");
|
|
|
List<String> configList = new ArrayList<>();
|
|
|
String configwfids = "";
|
|
|
if (rs.next()){
|
|
|
configwfids = rs.getString("workflowid");
|
|
|
}
|
|
|
if(!"".equals(configwfids)){
|
|
|
configList = new ArrayList<>(Arrays.asList(configwfids.split(",")));
|
|
|
}
|
|
|
|
|
|
if(configList == null) return;
|
|
|
|
|
|
if(efieldid.endsWith("_2") || efieldid.endsWith("_3") || efieldid.endsWith("_4")){//_2为主流程 _3为子流程 _4为本流程
|
|
|
String[] arr = efieldid.split("_");
|
|
|
if(arr.length == 3){
|
|
|
String worlflowid = Util.null2String(arr[0]);
|
|
|
if(configList.contains(worlflowid)){
|
|
|
this.needHide = true;
|
|
|
this.markkey = markkey+"_"+worlflowid;
|
|
|
new BaseBean().writeLog("[符合配置的流程]efieldid="+efieldid+",markkey(最后一个为主流程id)="+this.markkey);
|
|
|
return;
|
|
|
}
|
|
|
}else{
|
|
|
new BaseBean().writeLog("节点设置存在异常");
|
|
|
return ;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//qc1679821 将签字意见处理套一层div,使得折叠组件生效,并且加上隐藏的input,存储折叠组件默认打开的配置信息
|
|
|
private String getColumnString1(List<String> list, boolean needBr){
|
|
|
log.info("【进入签字意见折叠方法==========】:"+list.toString());
|
|
|
String result = "";
|
|
|
Map<String,String> groupDeptRemark = new LinkedHashMap<>();//用map存储,按照部门分组签字意见
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
String remarktemp = list.get(i);
|
|
|
Document doc = Jsoup.parse(remarktemp,"UTF-8");
|
|
|
Elements deptIdSpan = doc.select("[name=$remark_dept_id$");//获取部门id
|
|
|
String deptid = deptIdSpan.text();
|
|
|
if(groupDeptRemark.containsKey(deptid)){
|
|
|
String old = groupDeptRemark.get(deptid);
|
|
|
String newremark = old + remarktemp;//+hr控制是否换行
|
|
|
groupDeptRemark.replace(deptid,newremark);
|
|
|
}else{
|
|
|
groupDeptRemark.put(deptid,remarktemp);
|
|
|
}
|
|
|
}
|
|
|
log.info("【按照部门分组签字意见========】:"+groupDeptRemark);
|
|
|
for(Map.Entry<String, String> entry : groupDeptRemark.entrySet()){//遍历按部门分组后,该节点每个部门的签字意见
|
|
|
String remarkDeptid = entry.getKey();
|
|
|
String remarks = entry.getValue();
|
|
|
String depid = entry.getKey();
|
|
|
|
|
|
// String deptname = orgShowBiz.getDepartmentShow("workflow", depid);
|
|
|
|
|
|
String deptnameSql = "select departmentname from hrmdepartment where id = '"+depid+"'";
|
|
|
log.info("【查询部门名称deptnameSql========depid】:"+depid);
|
|
|
RecordSet rsdDept = new RecordSet();
|
|
|
rsdDept.executeQuery(deptnameSql);
|
|
|
String deptname ="";
|
|
|
if(rsdDept.next()){
|
|
|
deptname = rsdDept.getString("departmentname");
|
|
|
}
|
|
|
|
|
|
log.info("【查询部门名称deptname========】:"+deptname);
|
|
|
if("".equals(deptname)){
|
|
|
deptname = "系统管理员";
|
|
|
}
|
|
|
String nowUserdeptid = user.getUserDepartment()+"";
|
|
|
//2023.02.15查询上级部门ID
|
|
|
String nowDeptSql = "select supdepid from hrmdepartment where id = '"+nowUserdeptid+"'";
|
|
|
RecordSet rsd = new RecordSet();
|
|
|
rsd.executeQuery(nowDeptSql);
|
|
|
if(rsd.next()){
|
|
|
nowUserdeptid= rsd.getString("supdepid");
|
|
|
}
|
|
|
log.info("【获取当前用户的部门ID==========】:"+nowUserdeptid);
|
|
|
String display="";
|
|
|
String icon = "";
|
|
|
if(nowUserdeptid.equals(remarkDeptid)){//当前用户的部门签字意见 默认展开
|
|
|
display = "bolck";
|
|
|
icon = "/workflow/qc1679821/image/minus.png";
|
|
|
}else{
|
|
|
display = "none";
|
|
|
icon = "/workflow/qc1679821/image/add.png";
|
|
|
}
|
|
|
|
|
|
//一个部门对应一个折叠div 每个折叠div在表单中的id要独立,所以每次同一个请求的签字意见,根据缓存设计独立的id
|
|
|
String onlyKey = markkey+"_"+depid;//表单坐标+流程id+部门id组成折叠区域的唯一key
|
|
|
new BaseBean().writeLog("onlykey="+onlyKey+",display:"+display);
|
|
|
String imgstyle="background: url("+icon+");background-repeat: no-repeat;background-position:center;" +
|
|
|
"display: inline-block;vertical-align:middle;border:1px solid #bfbfbf;" +
|
|
|
"margin-right:10px;width:12px;height:12px"; //图标样式
|
|
|
remarks = "<div>" +
|
|
|
"<p onclick=controlDisplay('"+onlyKey+"') class='dep_qc_sign' style=''>" +
|
|
|
"<span id='icon_qc_"+onlyKey+"' style='"+imgstyle+"' ></span>"+deptname+"</p>" +
|
|
|
"<div id='accordion_qc_"+onlyKey+"' style='display:"+display+";' >" + remarks + "</div>" +
|
|
|
"</div>";
|
|
|
result += remarks;
|
|
|
}
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
private boolean needHide = false; //qc1679821 控制是否隐藏的标识
|
|
|
private String markkey; //qc1679821 本次意见对应的表单行列标
|
|
|
|
|
|
}
|