/* * * Copyright (c) 2001-2016 泛微软件. * 泛微协同商务系统,版权所有. * */ package weaver.fna.general; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.UnsupportedEncodingException; import java.io.Writer; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Random; import java.util.UUID; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import oracle.sql.CLOB; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringEscapeUtils; import weaver.conn.BatchRecordSet; import weaver.conn.ConnStatement; import weaver.conn.RecordSet; import weaver.fna.budget.BudgetApproveWFHandler; import weaver.fna.budget.BudgetHandler; import weaver.fna.budget.FnaFeeWfInfoComInfo; import weaver.fna.budget.FnaWfMultiSet; import weaver.fna.budget.FnaWfMultiSetFieldInfo; import weaver.fna.budget.FnaTableNameEnum; import weaver.fna.budget.FnaWfSet; import weaver.fna.budget.FnaWfSetCache; import weaver.fna.encrypt.Des; import weaver.fna.encrypt.RSAUtils; import weaver.fna.invoice.common.FnaInvoiceCommon; import weaver.fna.maintenance.BudgetfeeTypeComInfo; import weaver.fna.maintenance.FnaAdvanceAmountControl; import weaver.fna.maintenance.FnaAmountControl; import weaver.fna.maintenance.FnaBorrowAmountControl; import weaver.fna.maintenance.FnaChangeAmountControl; import weaver.fna.maintenance.FnaCostCenter; import weaver.fna.maintenance.FnaShareAmountControl; import weaver.fna.maintenance.FnaSplitTableByYearComInfo; import weaver.fna.maintenance.FnaSystemSetComInfo; import weaver.general.BaseBean; import weaver.general.TimeUtil; import weaver.general.Util; import weaver.hrm.User; import weaver.hrm.UserManager; import weaver.hrm.company.DepartmentComInfo; import weaver.hrm.company.SubCompanyComInfo; import weaver.hrm.resource.ResourceComInfo; import weaver.interfaces.workflow.action.FnaAdvanceEffectNew; import weaver.interfaces.workflow.action.FnaAdvanceReverseNew; import weaver.interfaces.workflow.action.FnaBorrowEffectNew; import weaver.interfaces.workflow.action.FnaBorrowReverseNew; import weaver.interfaces.workflow.action.FnaChangeEffectNew; import weaver.interfaces.workflow.action.FnaShareEffectNew; import weaver.interfaces.workflow.action.WorkflowFnaEffectNew; import weaver.interfaces.workflow.action.WorkflowFnaInWorkflowNew; import weaver.security.util.SecurityMethodUtil; import weaver.soa.workflow.request.RequestInfo; import weaver.soa.workflow.request.RequestService; import weaver.systeminfo.SysMaintenanceLog; import weaver.systeminfo.SystemEnv; import weaver.workflow.html.WFLayoutToHtml; import weaver.workflow.workflow.WorkflowVersion; import com.engine.fnaMulDimensions.biz.FnaExpenseInfoBiz; import com.engine.fnaMulDimensions.biz.TemplateFillReportBiz; import com.engine.fnaMulDimensions.biz.TemplateFillReportBizNew; import com.engine.fnaMulDimensions.biz.action.FnaFreezeBudget; import com.engine.fnaMulDimensions.biz.action.FnaReleaseBudget; import com.engine.fnaMulDimensions.util.FnaReimbursementUtils; import com.engine.fnaMulDimensions.util.FnaWorkflowSetUtils; import com.engine.fnaMulDimensions.util.FnaWorkflowUtil; /** * 预算通用工具类 * * @author 无聊的ck */ public class FnaCommon extends BaseBean { /** * 获取ip地址 * * @param request * @return */ public static String getRemoteAddr(HttpServletRequest request) { String ip = ""; try { ip = request.getHeader("x-forwarded-for"); } catch (Exception e) { } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { try { ip = request.getHeader("Proxy-Client-IP"); } catch (Exception e) { } } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { try { ip = request.getHeader("WL-Proxy-Client-IP"); } catch (Exception e) { } } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { try { ip = request.getRemoteAddr(); } catch (Exception e) { } } return ip; } /** * 加载流程html模板页面的流程的费用相关信息 * * @param formid * @param workflowid * @param requestid * @param otherPara_hs 传入WFLayoutToHtml的同名变量 */ public void loadWFLayoutToHtmlFnaInfo(int formid, int workflowid, int requestid, Hashtable otherPara_hs) { String sql = ""; RecordSet rs = new RecordSet(); //启用多明细表报销 int fnaWfTypeMultiReim = 0; sql = "select * from fnaFeeWfInfo where workflowid = " + workflowid; rs.executeQuery(sql); if (rs.next()) { fnaWfTypeMultiReim = rs.getInt("fnaWfTypeMultiReim"); } //启用多明细表报销,开关开启:当前流程的任意明细表都 【 可以用于也仅可以用于 】 费用报销;不再支持"还款,预付款冲销"功能; if (fnaWfTypeMultiReim == 1) { return; } String _key01 = "_isEnableFnaWfHm_FnaCommon.getIsEnableFnaWfHm_workflowid=" + workflowid + "__requestId=" + requestid; HashMap _isEnableFnaWfHm = new HashMap(); if (otherPara_hs.containsKey(_key01)) { _isEnableFnaWfHm = (HashMap) otherPara_hs.get(_key01); } else { _isEnableFnaWfHm = FnaCommon.getIsEnableFnaWfHm(workflowid); otherPara_hs.put(_key01, _isEnableFnaWfHm); } boolean isEnableFnaWfE8 = "true".equals(_isEnableFnaWfHm.get("isEnableFnaWfE8")); boolean isEnableFnaChangeWf = "true".equals(_isEnableFnaWfHm.get("isEnableFnaChangeWf")); boolean isEnableFnaShareWf = "true".equals(_isEnableFnaWfHm.get("isEnableFnaShareWf")); boolean isEnableFnaBorrowWf = "true".equals(_isEnableFnaWfHm.get("isEnableFnaBorrowWf")); boolean isEnableFnaRepaymentWf = "true".equals(_isEnableFnaWfHm.get("isEnableFnaRepaymentWf")); boolean enableRepayment = "true".equals(_isEnableFnaWfHm.get("enableRepayment")); boolean isEnableFnaAdvanceWf = "true".equals(_isEnableFnaWfHm.get("isEnableFnaAdvanceWf")); boolean enableReverseAdvance = "true".equals(_isEnableFnaWfHm.get("enableReverseAdvance")); if (isEnableFnaWfE8 || isEnableFnaChangeWf || isEnableFnaShareWf || isEnableFnaBorrowWf || isEnableFnaRepaymentWf || isEnableFnaAdvanceWf) { //读取财务相关流程字段对应关系 String _key001 = "_isEnableFnaWfHm_fnaBudgetControl.getFnaWfFieldInfo4Expense_workflowid=" + workflowid + "__requestId=" + requestid; Map fnaWfSetMap = null; if (otherPara_hs.containsKey(_key001)) { fnaWfSetMap = (HashMap) otherPara_hs.get(_key001); } else { fnaWfSetMap = new HashMap(); FnaCommon.getFnaWfFieldInfo4Expense(workflowid, fnaWfSetMap); otherPara_hs.put(_key001, fnaWfSetMap); } //读取费用报销流程、预算变更流程、费用分摊流程,第1个明细表中的数据库中的记录 if (isEnableFnaWfE8 || isEnableFnaChangeWf || isEnableFnaShareWf) { String _key002 = "_isEnableFnaWfHm_FnaCommon.qryFnaExpenseRequestRecord_workflowid=" + workflowid + "__requestId=" + requestid; if (!otherPara_hs.containsKey(_key002)) { HashMap> reqDataMap = FnaCommon.qryFnaExpenseRequestRecord(requestid, formid, fnaWfSetMap, isEnableFnaWfE8, isEnableFnaChangeWf, isEnableFnaShareWf); otherPara_hs.put(_key002, reqDataMap); } } //读取费用报销流程,写入费用表的数据库中的记录 if (isEnableFnaWfE8) { String _key002 = "_isEnableFnaWfHm_FnaCommon.qryFnaExpenseInfoAllRowRecordHm_workflowid=" + workflowid + "__requestId=" + requestid; if (!otherPara_hs.containsKey(_key002)) { HashMap> reqFnaExpenseDataMap = FnaCommon.qryFnaExpenseInfoAllRowRecordHm(requestid); otherPara_hs.put(_key002, reqFnaExpenseDataMap); } } //读取费用报销流程、还款流程,第2个明细表中的数据库中的记录 if ((isEnableFnaWfE8 && enableRepayment) || isEnableFnaRepaymentWf) { String _key002 = "_isEnableFnaWfHm_FnaCommon.qryFnaRepaymentRequestRecord_workflowid=" + workflowid + "__requestId=" + requestid; if (!otherPara_hs.containsKey(_key002)) { HashMap> reqRepaymentDataMap = FnaCommon.qryFnaRepaymentRequestRecord(requestid, formid, fnaWfSetMap); otherPara_hs.put(_key002, reqRepaymentDataMap); } } //读取费用报销流程,第4个明细表中的数据库中的记录 if ((isEnableFnaWfE8 && enableReverseAdvance)) { String _key002 = "_isEnableFnaWfHm_FnaCommon.qryFnaReverseAdvanceRequestRecord_workflowid=" + workflowid + "__requestId=" + requestid; if (!otherPara_hs.containsKey(_key002)) { HashMap> reqRepaymentDataMap = FnaCommon.qryFnaReverseAdvanceRequestRecord(requestid, formid, fnaWfSetMap); otherPara_hs.put(_key002, reqRepaymentDataMap); } } } } /** * 获取新建流程流程,流程表单对应费用承担主体类型字段的默认值(节点前附加操作/选择框默认值) * * @param workflowid * @param ortType_fieldid 流程表单对应费用承担主体类型字段的字段id * @return */ public static int getOrtTypeFieldidDefaultSelectValue(int workflowid, int ortType_fieldid) { int organizationtype = -1; RecordSet rs_fna = new RecordSet(); if (organizationtype < 0) { String sql2 = "select a.customervalue from workflow_addinoperate a " + " where a.fieldop1id = 0 and a.fieldop2id = 0 and a.operation = 0 " + " and a.workflowid = " + workflowid + " and a.fieldid = " + ortType_fieldid + " "; //_bb.writeLog("sql2 01="+sql2); rs_fna.executeSql(sql2); if (rs_fna.next()) { organizationtype = rs_fna.getInt("customervalue"); } } if (organizationtype < 0) { String sql2 = "select a.* from workflow_SelectItem a " + " where a.cancel = 0 and a.isdefault = 'y' and a.fieldid = " + ortType_fieldid + " " + " order by a.selectvalue asc"; rs_fna.executeSql(sql2); if (rs_fna.next()) { organizationtype = rs_fna.getInt("selectvalue"); } } return organizationtype; } /** * 获得GUID,数据库方式生成 * * @param dBType 数据库类型,目前只支持oracle和sqlServer * @return 32位长度,无符号-,其中英文字符随机大小写 */ public static String getPrimaryKeyGuid1SqlStr(String dBType) { String guid1SQlStr = "replace(newid(),'-','')"; if ("oracle".equalsIgnoreCase(dBType)) { guid1SQlStr = "SYS_GUID()"; } else if ("mysql".equalsIgnoreCase(dBType)) { guid1SQlStr = "replace(uuid(),'-','')"; } else if ("dm".equalsIgnoreCase(dBType)) { guid1SQlStr = "replace(SYS_GUID(),'0x','')"; } return guid1SQlStr; } /** * 获取自定义费控流程流程的字段对应关系Map对象 * * @param workflowid * @param dataMap 自定义费控流程流程的字段对应关系Map对象 * @return */ public static String getFnaWfFieldInfo4Expense(int workflowid, Map dataMap) { String fnaWfType = ""; String sql = ""; RecordSet rs = new RecordSet(); //启用多明细表报销 int fnaWfTypeMultiReim = 0; sql = "select * from fnaFeeWfInfo where workflowid = " + workflowid; rs.executeSql(sql); if (rs.next()) { fnaWfTypeMultiReim = rs.getInt("fnaWfTypeMultiReim"); fnaWfType = Util.null2String(rs.getString("fnaWfType")); } //启用多明细表报销,开关开启:当前流程的任意明细表都 【 可以用于也仅可以用于 】 费用报销;不再支持"还款,预付款冲销"功能; if (fnaWfTypeMultiReim == 1) { return fnaWfType; } //从缓存中加载-自定义费控流程流程的字段对应关系Map对象 //考虑到集群环境,屏蔽从缓存加载字段对应信息 if (false) {//FnaWfSetCache.loadFnaWfFieldSetMap(workflowid, dataMap) fnaWfType = dataMap.get("fnaWfType"); } else { sql = "select a.fieldType,a.fieldId,a.dtlNumber,b.fieldname,c.fnaWfType,d.formid, b.fieldhtmltype, b.type, b.detailtable, " + " a.isWfFieldLinkage, a.automaticTake, a.controlBorrowingWf, a.controlflowSubmission " + " from fnaFeeWfInfoField a " + " join workflow_billfield b on a.fieldId=b.id " + " join fnaFeeWfInfo c on a.mainId = c.id " + " join workflow_base d on a.workflowid = d.id " + " where a.workflowid = ?"; rs.executeQuery(sql, workflowid); while (rs.next()) { String fieldType = Util.null2String(rs.getString("fieldType")); String fieldId = Util.null2String(rs.getString("fieldId")); String dtlNumber = Util.null2String(rs.getString("dtlNumber")); String fieldName = Util.null2String(rs.getString("fieldname")); fnaWfType = Util.null2String(rs.getString("fnaWfType")); String formid = Util.getIntValue(rs.getString("formid"), 0) + ""; String fieldhtmltype = Util.null2String(rs.getString("fieldhtmltype")); String type = Util.null2String(rs.getString("type")); String _detailtable = Util.null2String(rs.getString("detailtable")); int is_detailtable = "".equals(_detailtable) ? 0 : 1; int isWfFieldLinkage = Util.getIntValue(rs.getString("isWfFieldLinkage"), 0); int automaticTake = Util.getIntValue(rs.getString("automaticTake"), 0); String controlBorrowingWf = Util.null2String(rs.getString("controlBorrowingWf")).trim(); int controlflowSubmission = Util.getIntValue(rs.getString("controlflowSubmission"), 1); dataMap.put("formid", formid); dataMap.put("fnaWfType", fnaWfType); if ("fnaFeeWf".equals(fnaWfType)) {//报销流程 String fieldIdSubject_isDtl = "1"; String fieldIdOrgType_isDtl = "1"; String fieldIdOrgId_isDtl = "1"; String fieldIdOccurdate_isDtl = "1"; if (Util.getIntValue(dtlNumber) == 0) { if (Util.getIntValue(fieldType) == 1) { dataMap.put("main_fieldIdSqr_fieldId", fieldId); dataMap.put("main_fieldIdSqr_fieldName", fieldName); dataMap.put(fieldId, "main_fieldIdSqr_fieldId"); dataMap.put("main_fieldIdSqr_fieldhtmltype", fieldhtmltype); dataMap.put("main_fieldIdSqr_type", type); dataMap.put("main_fieldIdSqr_controlBorrowingWf", controlBorrowingWf);//还款流程中通过申请人字段控制可选择的借款流程 } else if (Util.getIntValue(fieldType) == 2) { dataMap.put("main_fieldIdFysqlc_fieldId", fieldId); dataMap.put("main_fieldIdFysqlc_fieldName", fieldName); dataMap.put(fieldId, "main_fieldIdFysqlc_fieldId"); dataMap.put("main_fieldIdFysqlc_fieldhtmltype", fieldhtmltype); dataMap.put("main_fieldIdFysqlc_type", type); if (Util.getIntValue(fieldId) > 0) { dataMap.put("haveApplicationBudget", "true"); } else { dataMap.put("haveApplicationBudget", "false"); } dataMap.put("main_fieldIdFysqlc_isWfFieldLinkage", String.valueOf(isWfFieldLinkage)); dataMap.put("main_fieldIdFysqlc_controlflowSubmission", String.valueOf(controlflowSubmission)); } else if (Util.getIntValue(fieldType) == 3) { dataMap.put("main_fieldIdSfbxwc_fieldId", fieldId); dataMap.put("main_fieldIdSfbxwc_fieldName", fieldName); dataMap.put(fieldId, "main_fieldIdSfbxwc_fieldId"); dataMap.put("main_fieldIdSfbxwc_fieldhtmltype", fieldhtmltype); dataMap.put("main_fieldIdSfbxwc_type", type); } else if (Util.getIntValue(fieldType) == 4) { dataMap.put("main_fieldIdYfkZfHj_fieldId", fieldId); dataMap.put("main_fieldIdYfkZfHj_fieldName", fieldName); dataMap.put(fieldId, "main_fieldIdYfkZfHj_fieldId"); dataMap.put("main_fieldIdYfkZfHj_fieldhtmltype", fieldhtmltype); dataMap.put("main_fieldIdYfkZfHj_type", type); } else if (Util.getIntValue(fieldType) == 5) { dataMap.put("main_fieldIdSfysn_fieldId", fieldId); dataMap.put("main_fieldIdSfysn_fieldName", fieldName); dataMap.put(fieldId, "main_fieldIdSfysn_fieldId"); dataMap.put("main_fieldIdSfysn_fieldhtmltype", fieldhtmltype); dataMap.put("main_fieldIdSfysn_type", type); } } else if (Util.getIntValue(dtlNumber) == 1) { if (Util.getIntValue(fieldType) == 1) { dataMap.put("fieldIdSubject_fieldId", fieldId); dataMap.put("fieldIdSubject_fieldName", fieldName); dataMap.put(fieldId, "fieldIdSubject_fieldId"); dataMap.put("fieldIdSubject_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdSubject_type", type); fieldIdSubject_isDtl = "" + is_detailtable; dataMap.put("fieldIdSubject_fieldId_isDtl", fieldIdSubject_isDtl); } else if (Util.getIntValue(fieldType) == 2) { dataMap.put("fieldIdOrgType_fieldId", fieldId); dataMap.put("fieldIdOrgType_fieldName", fieldName); dataMap.put(fieldId, "fieldIdOrgType_fieldId"); dataMap.put("fieldIdOrgType_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdOrgType_type", type); fieldIdOrgType_isDtl = "" + is_detailtable; dataMap.put("fieldIdOrgType_fieldId_isDtl", fieldIdOrgType_isDtl); dataMap.put("fieldIdOrgType_defaultSelectValue", FnaCommon.getOrtTypeFieldidDefaultSelectValue(workflowid, Util.getIntValue(fieldId)) + ""); } else if (Util.getIntValue(fieldType) == 3) { dataMap.put("fieldIdOrgId_fieldId", fieldId); dataMap.put("fieldIdOrgId_fieldName", fieldName); dataMap.put(fieldId, "fieldIdOrgId_fieldId"); dataMap.put("fieldIdOrgId_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdOrgId_type", type); fieldIdOrgId_isDtl = "" + is_detailtable; dataMap.put("fieldIdOrgId_fieldId_isDtl", fieldIdOrgId_isDtl); dataMap.put("fieldIdOrgId_automaticTake", String.valueOf(automaticTake)); } else if (Util.getIntValue(fieldType) == 4) { dataMap.put("fieldIdOccurdate_fieldId", fieldId); dataMap.put("fieldIdOccurdate_fieldName", fieldName); dataMap.put(fieldId, "fieldIdOccurdate_fieldId"); dataMap.put("fieldIdOccurdate_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdOccurdate_type", type); fieldIdOccurdate_isDtl = "" + is_detailtable; dataMap.put("fieldIdOccurdate_fieldId_isDtl", fieldIdOccurdate_isDtl); } else if (Util.getIntValue(fieldType) == 5) { dataMap.put("fieldIdAmount_fieldId", fieldId); dataMap.put("fieldIdAmount_fieldName", fieldName); dataMap.put(fieldId, "fieldIdAmount_fieldId"); dataMap.put("fieldIdAmount_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdAmount_type", type); dataMap.put("fieldIdAmount_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 6) { dataMap.put("fieldIdHrmInfo_fieldId", fieldId); dataMap.put("fieldIdHrmInfo_fieldName", fieldName); dataMap.put(fieldId, "fieldIdHrmInfo_fieldId"); dataMap.put("fieldIdHrmInfo_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdHrmInfo_type", type); dataMap.put("fieldIdHrmInfo_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 7) { dataMap.put("fieldIdDepInfo_fieldId", fieldId); dataMap.put("fieldIdDepInfo_fieldName", fieldName); dataMap.put(fieldId, "fieldIdDepInfo_fieldId"); dataMap.put("fieldIdDepInfo_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdDepInfo_type", type); dataMap.put("fieldIdDepInfo_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 8) { dataMap.put("fieldIdSubInfo_fieldId", fieldId); dataMap.put("fieldIdSubInfo_fieldName", fieldName); dataMap.put(fieldId, "fieldIdSubInfo_fieldId"); dataMap.put("fieldIdSubInfo_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdSubInfo_type", type); dataMap.put("fieldIdSubInfo_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 9) { dataMap.put("fieldIdFccInfo_fieldId", fieldId); dataMap.put("fieldIdFccInfo_fieldName", fieldName); dataMap.put(fieldId, "fieldIdFccInfo_fieldId"); dataMap.put("fieldIdFccInfo_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdFccInfo_type", type); dataMap.put("fieldIdFccInfo_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 1000) { dataMap.put("fieldIdReqId_fieldId", fieldId); dataMap.put("fieldIdReqId_fieldName", fieldName); dataMap.put(fieldId, "fieldIdReqId_fieldId"); dataMap.put("fieldIdReqId_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdReqId_type", type); dataMap.put("fieldIdReqId_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 1010) { dataMap.put("fieldIdReqDtId_fieldId", fieldId); dataMap.put("fieldIdReqDtId_fieldName", fieldName); dataMap.put(fieldId, "fieldIdReqDtId_fieldId"); dataMap.put("fieldIdReqDtId_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdReqDtId_type", type); dataMap.put("fieldIdReqDtId_fieldId_isDtl", "" + is_detailtable); } } else if (Util.getIntValue(dtlNumber) == 2) { if (Util.getIntValue(fieldType) == 1) { dataMap.put("dt2_fieldIdJklc_fieldId", fieldId); dataMap.put("dt2_fieldIdJklc_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdJklc_fieldId"); dataMap.put("dt2_fieldIdJklc_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdJklc_type", type); } else if (Util.getIntValue(fieldType) == 2) { dataMap.put("dt2_fieldIdJkdh_fieldId", fieldId); dataMap.put("dt2_fieldIdJkdh_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdJkdh_fieldId"); dataMap.put("dt2_fieldIdJkdh_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdJkdh_type", type); } else if (Util.getIntValue(fieldType) == 3) { dataMap.put("dt2_fieldIdDnxh_fieldId", fieldId); dataMap.put("dt2_fieldIdDnxh_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdDnxh_fieldId"); dataMap.put("dt2_fieldIdDnxh_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdDnxh_type", type); } else if (Util.getIntValue(fieldType) == 4) { dataMap.put("dt2_fieldIdJkje_fieldId", fieldId); dataMap.put("dt2_fieldIdJkje_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdJkje_fieldId"); dataMap.put("dt2_fieldIdJkje_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdJkje_type", type); } else if (Util.getIntValue(fieldType) == 5) { dataMap.put("dt2_fieldIdYhje_fieldId", fieldId); dataMap.put("dt2_fieldIdYhje_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdYhje_fieldId"); dataMap.put("dt2_fieldIdYhje_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdYhje_type", type); } else if (Util.getIntValue(fieldType) == 6) { dataMap.put("dt2_fieldIdSpzje_fieldId", fieldId); dataMap.put("dt2_fieldIdSpzje_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdSpzje_fieldId"); dataMap.put("dt2_fieldIdSpzje_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdSpzje_type", type); } else if (Util.getIntValue(fieldType) == 7) { dataMap.put("dt2_fieldIdWhje_fieldId", fieldId); dataMap.put("dt2_fieldIdWhje_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdWhje_fieldId"); dataMap.put("dt2_fieldIdWhje_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdWhje_type", type); } else if (Util.getIntValue(fieldType) == 8) { dataMap.put("dt2_fieldIdCxje_fieldId", fieldId); dataMap.put("dt2_fieldIdCxje_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdCxje_fieldId"); dataMap.put("dt2_fieldIdCxje_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdCxje_type", type); } } else if (Util.getIntValue(dtlNumber) == 3) { if (Util.getIntValue(fieldType) == 1) { dataMap.put("dt3_fieldIdSkfs_fieldId", fieldId); dataMap.put("dt3_fieldIdSkfs_fieldName", fieldName); dataMap.put(fieldId, "dt3_fieldIdSkfs_fieldId"); dataMap.put("dt3_fieldIdSkfs_fieldhtmltype", fieldhtmltype); dataMap.put("dt3_fieldIdSkfs_type", type); } else if (Util.getIntValue(fieldType) == 2) { dataMap.put("dt3_fieldIdSkje_fieldId", fieldId); dataMap.put("dt3_fieldIdSkje_fieldName", fieldName); dataMap.put(fieldId, "dt3_fieldIdSkje_fieldId"); dataMap.put("dt3_fieldIdSkje_fieldhtmltype", fieldhtmltype); dataMap.put("dt3_fieldIdSkje_type", type); } else if (Util.getIntValue(fieldType) == 3) { dataMap.put("dt3_fieldIdKhyh_fieldId", fieldId); dataMap.put("dt3_fieldIdKhyh_fieldName", fieldName); dataMap.put(fieldId, "dt3_fieldIdKhyh_fieldId"); dataMap.put("dt3_fieldIdKhyh_fieldhtmltype", fieldhtmltype); dataMap.put("dt3_fieldIdKhyh_type", type); } else if (Util.getIntValue(fieldType) == 4) { dataMap.put("dt3_fieldIdHuming_fieldId", fieldId); dataMap.put("dt3_fieldIdHuming_fieldName", fieldName); dataMap.put(fieldId, "dt3_fieldIdHuming_fieldId"); dataMap.put("dt3_fieldIdHuming_fieldhtmltype", fieldhtmltype); dataMap.put("dt3_fieldIdHuming_type", type); } else if (Util.getIntValue(fieldType) == 5) { dataMap.put("dt3_fieldIdSkzh_fieldId", fieldId); dataMap.put("dt3_fieldIdSkzh_fieldName", fieldName); dataMap.put(fieldId, "dt3_fieldIdSkzh_fieldId"); dataMap.put("dt3_fieldIdSkzh_fieldhtmltype", fieldhtmltype); dataMap.put("dt3_fieldIdSkzh_type", type); } } else if (Util.getIntValue(dtlNumber) == 4) { if (Util.getIntValue(fieldType) == 1) { dataMap.put("dt4_fieldIdYfklc_fieldId", fieldId); dataMap.put("dt4_fieldIdYfklc_fieldName", fieldName); dataMap.put(fieldId, "dt4_fieldIdYfklc_fieldId"); dataMap.put("dt4_fieldIdYfklc_fieldhtmltype", fieldhtmltype); dataMap.put("dt4_fieldIdYfklc_type", type); } else if (Util.getIntValue(fieldType) == 2) { dataMap.put("dt4_fieldIdYfkdh_fieldId", fieldId); dataMap.put("dt4_fieldIdYfkdh_fieldName", fieldName); dataMap.put(fieldId, "dt4_fieldIdYfkdh_fieldId"); dataMap.put("dt4_fieldIdYfkdh_fieldhtmltype", fieldhtmltype); dataMap.put("dt4_fieldIdYfkdh_type", type); } else if (Util.getIntValue(fieldType) == 3) { dataMap.put("dt4_fieldIdDnxh_fieldId", fieldId); dataMap.put("dt4_fieldIdDnxh_fieldName", fieldName); dataMap.put(fieldId, "dt4_fieldIdDnxh_fieldId"); dataMap.put("dt4_fieldIdDnxh_fieldhtmltype", fieldhtmltype); dataMap.put("dt4_fieldIdDnxh_type", type); } else if (Util.getIntValue(fieldType) == 4) { dataMap.put("dt4_fieldIdYfkje_fieldId", fieldId); dataMap.put("dt4_fieldIdYfkje_fieldName", fieldName); dataMap.put(fieldId, "dt4_fieldIdYfkje_fieldId"); dataMap.put("dt4_fieldIdYfkje_fieldhtmltype", fieldhtmltype); dataMap.put("dt4_fieldIdYfkje_type", type); } else if (Util.getIntValue(fieldType) == 5) { dataMap.put("dt4_fieldIdYhje_fieldId", fieldId); dataMap.put("dt4_fieldIdYhje_fieldName", fieldName); dataMap.put(fieldId, "dt4_fieldIdYhje_fieldId"); dataMap.put("dt4_fieldIdYhje_fieldhtmltype", fieldhtmltype); dataMap.put("dt4_fieldIdYhje_type", type); } else if (Util.getIntValue(fieldType) == 6) { dataMap.put("dt4_fieldIdSpzje_fieldId", fieldId); dataMap.put("dt4_fieldIdSpzje_fieldName", fieldName); dataMap.put(fieldId, "dt4_fieldIdSpzje_fieldId"); dataMap.put("dt4_fieldIdSpzje_fieldhtmltype", fieldhtmltype); dataMap.put("dt4_fieldIdSpzje_type", type); } else if (Util.getIntValue(fieldType) == 7) { dataMap.put("dt4_fieldIdWhje_fieldId", fieldId); dataMap.put("dt4_fieldIdWhje_fieldName", fieldName); dataMap.put(fieldId, "dt4_fieldIdWhje_fieldId"); dataMap.put("dt4_fieldIdWhje_fieldhtmltype", fieldhtmltype); dataMap.put("dt4_fieldIdWhje_type", type); } else if (Util.getIntValue(fieldType) == 8) { dataMap.put("dt4_fieldIdCxje_fieldId", fieldId); dataMap.put("dt4_fieldIdCxje_fieldName", fieldName); dataMap.put(fieldId, "dt4_fieldIdCxje_fieldId"); dataMap.put("dt4_fieldIdCxje_fieldhtmltype", fieldhtmltype); dataMap.put("dt4_fieldIdCxje_type", type); } } boolean dt1_haveIsDtlField = ("1".equals(fieldIdSubject_isDtl) || "1".equals(fieldIdOrgType_isDtl) || "1".equals(fieldIdOrgId_isDtl) || "1".equals(fieldIdOccurdate_isDtl)); dataMap.put("dt1_haveIsDtlField", dt1_haveIsDtlField ? "true" : "false"); } else if ("borrow".equals(fnaWfType)) {//借款流程 if (Util.getIntValue(dtlNumber) == 0) { if (Util.getIntValue(fieldType) == 1) { dataMap.put("main_fieldIdSqr_fieldId", fieldId);//1:申请人; dataMap.put("main_fieldIdSqr_fieldName", fieldName); dataMap.put(fieldId, "main_fieldIdSqr_fieldId"); dataMap.put("main_fieldIdSqr_fieldhtmltype", fieldhtmltype); dataMap.put("main_fieldIdSqr_type", type); } } else if (Util.getIntValue(dtlNumber) == 1) { if (Util.getIntValue(fieldType) == 1) { dataMap.put("dt1_fieldIdJklx_fieldId", fieldId);//1:借款类型; dataMap.put("dt1_fieldIdJklx_fieldName", fieldName); dataMap.put(fieldId, "dt1_fieldIdJklx_fieldId"); dataMap.put("dt1_fieldIdJklx_fieldhtmltype", fieldhtmltype); dataMap.put("dt1_fieldIdJklx_type", type); } else if (Util.getIntValue(fieldType) == 2) { dataMap.put("dt1_fieldIdJkje_fieldId", fieldId);//2:借款金额; dataMap.put("dt1_fieldIdJkje_fieldName", fieldName); dataMap.put(fieldId, "dt1_fieldIdJkje_fieldId"); dataMap.put("dt1_fieldIdJkje_fieldhtmltype", fieldhtmltype); dataMap.put("dt1_fieldIdJkje_type", type); } else if (Util.getIntValue(fieldType) == 3) { dataMap.put("dt1_fieldIdJkmx_fieldId", fieldId);//3:调整明细; dataMap.put("dt1_fieldIdJkmx_fieldName", fieldName); dataMap.put(fieldId, "dt1_fieldIdJkmx_fieldId"); dataMap.put("dt1_fieldIdJkmx_fieldhtmltype", fieldhtmltype); dataMap.put("dt1_fieldIdJkmx_type", type); } else if (Util.getIntValue(fieldType) == 4) { dataMap.put("dt1_fieldIdJksm_fieldId", fieldId);//4:借款说明; dataMap.put("dt1_fieldIdJksm_fieldName", fieldName); dataMap.put(fieldId, "dt1_fieldIdJksm_fieldId"); dataMap.put("dt1_fieldIdJksm_fieldhtmltype", fieldhtmltype); dataMap.put("dt1_fieldIdJksm_type", type); } else if (Util.getIntValue(fieldType) == 5) { dataMap.put("dt1_fieldIdXghklc_fieldId", fieldId);//5:相关还款流程; dataMap.put("dt1_fieldIdXghklc_fieldName", fieldName); dataMap.put(fieldId, "dt1_fieldIdXghklc_fieldId"); dataMap.put("dt1_fieldIdXghklc_fieldhtmltype", fieldhtmltype); dataMap.put("dt1_fieldIdXghklc_type", type); } } else if (Util.getIntValue(dtlNumber) == 2) { if (Util.getIntValue(fieldType) == 1) { dataMap.put("dt2_fieldIdSkfs_fieldId", fieldId);//1:收款方式; dataMap.put("dt2_fieldIdSkfs_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdSkfs_fieldId"); dataMap.put("dt2_fieldIdSkfs_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdSkfs_type", type); } else if (Util.getIntValue(fieldType) == 2) { dataMap.put("dt2_fieldIdSkje_fieldId", fieldId);//2:收款金额; dataMap.put("dt2_fieldIdSkje_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdSkje_fieldId"); dataMap.put("dt2_fieldIdSkje_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdSkje_type", type); } else if (Util.getIntValue(fieldType) == 3) { dataMap.put("dt2_fieldIdKhyh_fieldId", fieldId);//3:开户银行; dataMap.put("dt2_fieldIdKhyh_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdKhyh_fieldId"); dataMap.put("dt2_fieldIdKhyh_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdKhyh_type", type); } else if (Util.getIntValue(fieldType) == 4) { dataMap.put("dt2_fieldIdHuming_fieldId", fieldId);//4:户名; dataMap.put("dt2_fieldIdHuming_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdHuming_fieldId"); dataMap.put("dt2_fieldIdHuming_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdHuming_type", type); } else if (Util.getIntValue(fieldType) == 5) { dataMap.put("dt2_fieldIdSkzh_fieldId", fieldId);//5:收款账号; dataMap.put("dt2_fieldIdSkzh_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdSkzh_fieldId"); dataMap.put("dt2_fieldIdSkzh_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdSkzh_type", type); } } } else if ("repayment".equals(fnaWfType)) {//还款流程 if (Util.getIntValue(dtlNumber) == 0) { if (Util.getIntValue(fieldType) == 1) { dataMap.put("main_fieldIdSqr_fieldId", fieldId);//1:申请人; dataMap.put("main_fieldIdSqr_fieldName", fieldName); dataMap.put(fieldId, "main_fieldIdSqr_fieldId"); dataMap.put("main_fieldIdSqr_fieldhtmltype", fieldhtmltype); dataMap.put("main_fieldIdSqr_type", type); dataMap.put("main_fieldIdSqr_controlBorrowingWf", controlBorrowingWf);//还款流程中通过申请人字段控制可选择的借款流程 } } else if (Util.getIntValue(dtlNumber) == 1) { if (Util.getIntValue(fieldType) == 1) { dataMap.put("dt1_fieldIdHklx_fieldId", fieldId);//1:还款类型; dataMap.put("dt1_fieldIdHklx_fieldName", fieldName); dataMap.put(fieldId, "dt1_fieldIdHklx_fieldId"); dataMap.put("dt1_fieldIdHklx_fieldhtmltype", fieldhtmltype); dataMap.put("dt1_fieldIdHklx_type", type); } else if (Util.getIntValue(fieldType) == 2) { dataMap.put("dt1_fieldIdHkje_fieldId", fieldId);//2:还款金额; dataMap.put("dt1_fieldIdHkje_fieldName", fieldName); dataMap.put(fieldId, "dt1_fieldIdHkje_fieldId"); dataMap.put("dt1_fieldIdHkje_fieldhtmltype", fieldhtmltype); dataMap.put("dt1_fieldIdHkje_type", type); } else if (Util.getIntValue(fieldType) == 3) { dataMap.put("dt1_fieldIdTzmx_fieldId", fieldId);//3:调整明细; dataMap.put("dt1_fieldIdTzmx_fieldName", fieldName); dataMap.put(fieldId, "dt1_fieldIdTzmx_fieldId"); dataMap.put("dt1_fieldIdTzmx_fieldhtmltype", fieldhtmltype); dataMap.put("dt1_fieldIdTzmx_type", type); } } else if (Util.getIntValue(dtlNumber) == 2) { if (Util.getIntValue(fieldType) == 1) { dataMap.put("dt2_fieldIdJklc_fieldId", fieldId);//1:借款类型; dataMap.put("dt2_fieldIdJklc_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdJklc_fieldId"); dataMap.put("dt2_fieldIdJklc_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdJklc_type", type); } else if (Util.getIntValue(fieldType) == 2) { dataMap.put("dt2_fieldIdJkdh_fieldId", fieldId);//2:借款单号; dataMap.put("dt2_fieldIdJkdh_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdJkdh_fieldId"); dataMap.put("dt2_fieldIdJkdh_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdJkdh_type", type); } else if (Util.getIntValue(fieldType) == 3) { dataMap.put("dt2_fieldIdDnxh_fieldId", fieldId);//3:单内序号; dataMap.put("dt2_fieldIdDnxh_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdDnxh_fieldId"); dataMap.put("dt2_fieldIdDnxh_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdDnxh_type", type); } else if (Util.getIntValue(fieldType) == 4) { dataMap.put("dt2_fieldIdJkje_fieldId", fieldId);//4:借款金额; dataMap.put("dt2_fieldIdJkje_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdJkje_fieldId"); dataMap.put("dt2_fieldIdJkje_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdJkje_type", type); } else if (Util.getIntValue(fieldType) == 5) { dataMap.put("dt2_fieldIdYhje_fieldId", fieldId);//5:已还借款金额; dataMap.put("dt2_fieldIdYhje_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdYhje_fieldId"); dataMap.put("dt2_fieldIdYhje_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdYhje_type", type); } else if (Util.getIntValue(fieldType) == 6) { dataMap.put("dt2_fieldIdSpzje_fieldId", fieldId);//6:审批中还款金额; dataMap.put("dt2_fieldIdSpzje_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdSpzje_fieldId"); dataMap.put("dt2_fieldIdSpzje_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdSpzje_type", type); } else if (Util.getIntValue(fieldType) == 7) { dataMap.put("dt2_fieldIdWhje_fieldId", fieldId);//7:未还借款金额; dataMap.put("dt2_fieldIdWhje_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdWhje_fieldId"); dataMap.put("dt2_fieldIdWhje_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdWhje_type", type); } else if (Util.getIntValue(fieldType) == 8) { dataMap.put("dt2_fieldIdCxje_fieldId", fieldId);//8:冲销借款金额; dataMap.put("dt2_fieldIdCxje_fieldName", fieldName); dataMap.put(fieldId, "dt2_fieldIdCxje_fieldId"); dataMap.put("dt2_fieldIdCxje_fieldhtmltype", fieldhtmltype); dataMap.put("dt2_fieldIdCxje_type", type); } } } else if ("change".equals(fnaWfType)) {//预算变更 String fieldIdSubject_isDtl = "1"; String fieldIdOrgType_isDtl = "1"; String fieldIdOrgId_isDtl = "1"; String fieldIdOccurdate_isDtl = "1"; String fieldIdSubject2_isDtl = "1"; String fieldIdOrgType2_isDtl = "1"; String fieldIdOrgId2_isDtl = "1"; String fieldIdOccurdate2_isDtl = "1"; if (Util.getIntValue(dtlNumber) == 1) { if (Util.getIntValue(fieldType) == 1) { dataMap.put("fieldIdSubject_fieldId", fieldId); dataMap.put("fieldIdSubject_fieldName", fieldName); dataMap.put(fieldId, "fieldIdSubject_fieldId"); dataMap.put("fieldIdSubject_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdSubject_type", type); fieldIdSubject_isDtl = "" + is_detailtable; dataMap.put("fieldIdSubject_fieldId_isDtl", fieldIdSubject_isDtl); } else if (Util.getIntValue(fieldType) == 2) { dataMap.put("fieldIdOrgType_fieldId", fieldId); dataMap.put("fieldIdOrgType_fieldName", fieldName); dataMap.put(fieldId, "fieldIdOrgType_fieldId"); dataMap.put("fieldIdOrgType_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdOrgType_type", type); fieldIdOrgType_isDtl = "" + is_detailtable; dataMap.put("fieldIdOrgType_fieldId_isDtl", fieldIdOrgType_isDtl); dataMap.put("fieldIdOrgType_defaultSelectValue", FnaCommon.getOrtTypeFieldidDefaultSelectValue(workflowid, Util.getIntValue(fieldId)) + ""); } else if (Util.getIntValue(fieldType) == 3) { dataMap.put("fieldIdOrgId_fieldId", fieldId); dataMap.put("fieldIdOrgId_fieldName", fieldName); dataMap.put(fieldId, "fieldIdOrgId_fieldId"); dataMap.put("fieldIdOrgId_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdOrgId_type", type); dataMap.put("fieldIdOrgId_automaticTake", String.valueOf(automaticTake)); fieldIdOrgId_isDtl = "" + is_detailtable; dataMap.put("fieldIdOrgId_fieldId_isDtl", fieldIdOrgId_isDtl); } else if (Util.getIntValue(fieldType) == 4) { dataMap.put("fieldIdOccurdate_fieldId", fieldId); dataMap.put("fieldIdOccurdate_fieldName", fieldName); dataMap.put(fieldId, "fieldIdOccurdate_fieldId"); dataMap.put("fieldIdOccurdate_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdOccurdate_type", type); fieldIdOccurdate_isDtl = "" + is_detailtable; dataMap.put("fieldIdOccurdate_fieldId_isDtl", fieldIdOccurdate_isDtl); } else if (Util.getIntValue(fieldType) == 5) { dataMap.put("fieldIdAmount_fieldId", fieldId); dataMap.put("fieldIdAmount_fieldName", fieldName); dataMap.put(fieldId, "fieldIdAmount_fieldId"); dataMap.put("fieldIdAmount_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdAmount_type", type); dataMap.put("fieldIdAmount_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 6) { dataMap.put("fieldIdHrmInfo_fieldId", fieldId); dataMap.put("fieldIdHrmInfo_fieldName", fieldName); dataMap.put(fieldId, "fieldIdHrmInfo_fieldId"); dataMap.put("fieldIdHrmInfo_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdHrmInfo_type", type); dataMap.put("fieldIdHrmInfo_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 7) { dataMap.put("fieldIdDepInfo_fieldId", fieldId); dataMap.put("fieldIdDepInfo_fieldName", fieldName); dataMap.put(fieldId, "fieldIdDepInfo_fieldId"); dataMap.put("fieldIdDepInfo_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdDepInfo_type", type); dataMap.put("fieldIdDepInfo_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 8) { dataMap.put("fieldIdSubInfo_fieldId", fieldId); dataMap.put("fieldIdSubInfo_fieldName", fieldName); dataMap.put(fieldId, "fieldIdSubInfo_fieldId"); dataMap.put("fieldIdSubInfo_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdSubInfo_type", type); dataMap.put("fieldIdSubInfo_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 9) { dataMap.put("fieldIdFccInfo_fieldId", fieldId); dataMap.put("fieldIdFccInfo_fieldName", fieldName); dataMap.put(fieldId, "fieldIdFccInfo_fieldId"); dataMap.put("fieldIdFccInfo_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdFccInfo_type", type); dataMap.put("fieldIdFccInfo_fieldId_isDtl", "" + is_detailtable); } if (Util.getIntValue(fieldType) == 10) { dataMap.put("fieldIdSubject2_fieldId", fieldId); dataMap.put("fieldIdSubject2_fieldName", fieldName); dataMap.put(fieldId, "fieldIdSubject2_fieldId"); dataMap.put("fieldIdSubject2_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdSubject2_type", type); fieldIdSubject2_isDtl = "" + is_detailtable; dataMap.put("fieldIdSubject2_fieldId_isDtl", fieldIdSubject2_isDtl); } else if (Util.getIntValue(fieldType) == 11) { dataMap.put("fieldIdOrgType2_fieldId", fieldId); dataMap.put("fieldIdOrgType2_fieldName", fieldName); dataMap.put(fieldId, "fieldIdOrgType2_fieldId"); dataMap.put("fieldIdOrgType2_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdOrgType2_type", type); fieldIdOrgType2_isDtl = "" + is_detailtable; dataMap.put("fieldIdOrgType2_fieldId_isDtl", fieldIdOrgType2_isDtl); dataMap.put("fieldIdOrgType2_defaultSelectValue", FnaCommon.getOrtTypeFieldidDefaultSelectValue(workflowid, Util.getIntValue(fieldId)) + ""); } else if (Util.getIntValue(fieldType) == 12) { dataMap.put("fieldIdOrgId2_fieldId", fieldId); dataMap.put("fieldIdOrgId2_fieldName", fieldName); dataMap.put(fieldId, "fieldIdOrgId2_fieldId"); dataMap.put("fieldIdOrgId2_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdOrgId2_type", type); dataMap.put("fieldIdOrgId2_automaticTake", String.valueOf(automaticTake)); fieldIdOrgId2_isDtl = "" + is_detailtable; dataMap.put("fieldIdOrgId2_fieldId_isDtl", fieldIdOrgId2_isDtl); } else if (Util.getIntValue(fieldType) == 13) { dataMap.put("fieldIdOccurdate2_fieldId", fieldId); dataMap.put("fieldIdOccurdate2_fieldName", fieldName); dataMap.put(fieldId, "fieldIdOccurdate2_fieldId"); dataMap.put("fieldIdOccurdate2_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdOccurdate2_type", type); fieldIdOccurdate2_isDtl = "" + is_detailtable; dataMap.put("fieldIdOccurdate2_fieldId_isDtl", fieldIdOccurdate2_isDtl); } else if (Util.getIntValue(fieldType) == 14) { dataMap.put("fieldIdHrmInfo2_fieldId", fieldId); dataMap.put("fieldIdHrmInfo2_fieldName", fieldName); dataMap.put(fieldId, "fieldIdHrmInfo2_fieldId"); dataMap.put("fieldIdHrmInfo2_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdHrmInfo2_type", type); dataMap.put("fieldIdHrmInfo2_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 15) { dataMap.put("fieldIdDepInfo2_fieldId", fieldId); dataMap.put("fieldIdDepInfo2_fieldName", fieldName); dataMap.put(fieldId, "fieldIdDepInfo2_fieldId"); dataMap.put("fieldIdDepInfo2_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdDepInfo2_type", type); dataMap.put("fieldIdDepInfo2_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 16) { dataMap.put("fieldIdSubInfo2_fieldId", fieldId); dataMap.put("fieldIdSubInfo2_fieldName", fieldName); dataMap.put(fieldId, "fieldIdSubInfo2_fieldId"); dataMap.put("fieldIdSubInfo2_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdSubInfo2_type", type); dataMap.put("fieldIdSubInfo2_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 17) { dataMap.put("fieldIdFccInfo2_fieldId", fieldId); dataMap.put("fieldIdFccInfo2_fieldName", fieldName); dataMap.put(fieldId, "fieldIdFccInfo2_fieldId"); dataMap.put("fieldIdFccInfo2_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdFccInfo2_type", type); dataMap.put("fieldIdFccInfo2_fieldId_isDtl", "" + is_detailtable); } } boolean dt1_haveIsDtlField = ("1".equals(fieldIdSubject_isDtl) || "1".equals(fieldIdOrgType_isDtl) || "1".equals(fieldIdOrgId_isDtl) || "1".equals(fieldIdOccurdate_isDtl)); dataMap.put("dt1_haveIsDtlField", dt1_haveIsDtlField ? "true" : "false"); boolean dt1_haveIsDtlField2 = ("1".equals(fieldIdSubject2_isDtl) || "1".equals(fieldIdOrgType2_isDtl) || "1".equals(fieldIdOrgId2_isDtl) || "1".equals(fieldIdOccurdate2_isDtl)); dataMap.put("dt1_haveIsDtlField2", dt1_haveIsDtlField2 ? "true" : "false"); } else if ("share".equals(fnaWfType)) {//费用分摊 String fieldIdSubject_isDtl = "1"; String fieldIdOrgType_isDtl = "1"; String fieldIdOrgId_isDtl = "1"; String fieldIdOccurdate_isDtl = "1"; String fieldIdSubject2_isDtl = "1"; String fieldIdOrgType2_isDtl = "1"; String fieldIdOrgId2_isDtl = "1"; String fieldIdOccurdate2_isDtl = "1"; if (Util.getIntValue(dtlNumber) == 1) { if (Util.getIntValue(fieldType) == 1) { dataMap.put("fieldIdSubject_fieldId", fieldId); dataMap.put("fieldIdSubject_fieldName", fieldName); dataMap.put(fieldId, "fieldIdSubject_fieldId"); dataMap.put("fieldIdSubject_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdSubject_type", type); fieldIdSubject_isDtl = "" + is_detailtable; dataMap.put("fieldIdSubject_fieldId_isDtl", fieldIdSubject_isDtl); } else if (Util.getIntValue(fieldType) == 2) { dataMap.put("fieldIdOrgType_fieldId", fieldId); dataMap.put("fieldIdOrgType_fieldName", fieldName); dataMap.put(fieldId, "fieldIdOrgType_fieldId"); dataMap.put("fieldIdOrgType_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdOrgType_type", type); fieldIdOrgType_isDtl = "" + is_detailtable; dataMap.put("fieldIdOrgType_fieldId_isDtl", fieldIdOrgType_isDtl); dataMap.put("fieldIdOrgType_defaultSelectValue", FnaCommon.getOrtTypeFieldidDefaultSelectValue(workflowid, Util.getIntValue(fieldId)) + ""); } else if (Util.getIntValue(fieldType) == 3) { dataMap.put("fieldIdOrgId_fieldId", fieldId); dataMap.put("fieldIdOrgId_fieldName", fieldName); dataMap.put(fieldId, "fieldIdOrgId_fieldId"); dataMap.put("fieldIdOrgId_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdOrgId_type", type); dataMap.put("fieldIdOrgId_automaticTake", String.valueOf(automaticTake)); fieldIdOrgId_isDtl = "" + is_detailtable; dataMap.put("fieldIdOrgId_fieldId_isDtl", fieldIdOrgId_isDtl); } else if (Util.getIntValue(fieldType) == 4) { dataMap.put("fieldIdOccurdate_fieldId", fieldId); dataMap.put("fieldIdOccurdate_fieldName", fieldName); dataMap.put(fieldId, "fieldIdOccurdate_fieldId"); dataMap.put("fieldIdOccurdate_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdOccurdate_type", type); fieldIdOccurdate_isDtl = "" + is_detailtable; dataMap.put("fieldIdOccurdate_fieldId_isDtl", fieldIdOccurdate_isDtl); } else if (Util.getIntValue(fieldType) == 5) { dataMap.put("fieldIdAmount_fieldId", fieldId); dataMap.put("fieldIdAmount_fieldName", fieldName); dataMap.put(fieldId, "fieldIdAmount_fieldId"); dataMap.put("fieldIdAmount_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdAmount_type", type); dataMap.put("fieldIdAmount_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 6) { dataMap.put("fieldIdHrmInfo_fieldId", fieldId); dataMap.put("fieldIdHrmInfo_fieldName", fieldName); dataMap.put(fieldId, "fieldIdHrmInfo_fieldId"); dataMap.put("fieldIdHrmInfo_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdHrmInfo_type", type); dataMap.put("fieldIdHrmInfo_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 7) { dataMap.put("fieldIdDepInfo_fieldId", fieldId); dataMap.put("fieldIdDepInfo_fieldName", fieldName); dataMap.put(fieldId, "fieldIdDepInfo_fieldId"); dataMap.put("fieldIdDepInfo_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdDepInfo_type", type); dataMap.put("fieldIdDepInfo_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 8) { dataMap.put("fieldIdSubInfo_fieldId", fieldId); dataMap.put("fieldIdSubInfo_fieldName", fieldName); dataMap.put(fieldId, "fieldIdSubInfo_fieldId"); dataMap.put("fieldIdSubInfo_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdSubInfo_type", type); dataMap.put("fieldIdSubInfo_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 9) { dataMap.put("fieldIdFccInfo_fieldId", fieldId); dataMap.put("fieldIdFccInfo_fieldName", fieldName); dataMap.put(fieldId, "fieldIdFccInfo_fieldId"); dataMap.put("fieldIdFccInfo_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdFccInfo_type", type); dataMap.put("fieldIdFccInfo_fieldId_isDtl", "" + is_detailtable); } if (Util.getIntValue(fieldType) == 10) { dataMap.put("fieldIdSubject2_fieldId", fieldId); dataMap.put("fieldIdSubject2_fieldName", fieldName); dataMap.put(fieldId, "fieldIdSubject2_fieldId"); dataMap.put("fieldIdSubject2_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdSubject2_type", type); fieldIdSubject2_isDtl = "" + is_detailtable; dataMap.put("fieldIdSubject2_fieldId_isDtl", fieldIdSubject2_isDtl); } else if (Util.getIntValue(fieldType) == 11) { dataMap.put("fieldIdOrgType2_fieldId", fieldId); dataMap.put("fieldIdOrgType2_fieldName", fieldName); dataMap.put(fieldId, "fieldIdOrgType2_fieldId"); dataMap.put("fieldIdOrgType2_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdOrgType2_type", type); fieldIdOrgType2_isDtl = "" + is_detailtable; dataMap.put("fieldIdOrgType2_fieldId_isDtl", fieldIdOrgType2_isDtl); dataMap.put("fieldIdOrgType2_defaultSelectValue", FnaCommon.getOrtTypeFieldidDefaultSelectValue(workflowid, Util.getIntValue(fieldId)) + ""); } else if (Util.getIntValue(fieldType) == 12) { dataMap.put("fieldIdOrgId2_fieldId", fieldId); dataMap.put("fieldIdOrgId2_fieldName", fieldName); dataMap.put(fieldId, "fieldIdOrgId2_fieldId"); dataMap.put("fieldIdOrgId2_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdOrgId2_type", type); dataMap.put("fieldIdOrgId2_automaticTake", String.valueOf(automaticTake)); fieldIdOrgId2_isDtl = "" + is_detailtable; dataMap.put("fieldIdOrgId2_fieldId_isDtl", fieldIdOrgId2_isDtl); } else if (Util.getIntValue(fieldType) == 13) { dataMap.put("fieldIdOccurdate2_fieldId", fieldId); dataMap.put("fieldIdOccurdate2_fieldName", fieldName); dataMap.put(fieldId, "fieldIdOccurdate2_fieldId"); dataMap.put("fieldIdOccurdate2_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdOccurdate2_type", type); fieldIdOccurdate2_isDtl = "" + is_detailtable; dataMap.put("fieldIdOccurdate2_fieldId_isDtl", fieldIdOccurdate2_isDtl); } else if (Util.getIntValue(fieldType) == 14) { dataMap.put("fieldIdHrmInfo2_fieldId", fieldId); dataMap.put("fieldIdHrmInfo2_fieldName", fieldName); dataMap.put(fieldId, "fieldIdHrmInfo2_fieldId"); dataMap.put("fieldIdHrmInfo2_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdHrmInfo2_type", type); dataMap.put("fieldIdHrmInfo2_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 15) { dataMap.put("fieldIdDepInfo2_fieldId", fieldId); dataMap.put("fieldIdDepInfo2_fieldName", fieldName); dataMap.put(fieldId, "fieldIdDepInfo2_fieldId"); dataMap.put("fieldIdDepInfo2_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdDepInfo2_type", type); dataMap.put("fieldIdDepInfo2_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 16) { dataMap.put("fieldIdSubInfo2_fieldId", fieldId); dataMap.put("fieldIdSubInfo2_fieldName", fieldName); dataMap.put(fieldId, "fieldIdSubInfo2_fieldId"); dataMap.put("fieldIdSubInfo2_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdSubInfo2_type", type); dataMap.put("fieldIdSubInfo2_fieldId_isDtl", "" + is_detailtable); } else if (Util.getIntValue(fieldType) == 17) { dataMap.put("fieldIdFccInfo2_fieldId", fieldId); dataMap.put("fieldIdFccInfo2_fieldName", fieldName); dataMap.put(fieldId, "fieldIdFccInfo2_fieldId"); dataMap.put("fieldIdFccInfo2_fieldhtmltype", fieldhtmltype); dataMap.put("fieldIdFccInfo2_type", type); dataMap.put("fieldIdFccInfo2_fieldId_isDtl", "" + is_detailtable); } } boolean dt1_haveIsDtlField = ("1".equals(fieldIdSubject_isDtl) || "1".equals(fieldIdOrgType_isDtl) || "1".equals(fieldIdOrgId_isDtl) || "1".equals(fieldIdOccurdate_isDtl)); dataMap.put("dt1_haveIsDtlField", dt1_haveIsDtlField ? "true" : "false"); boolean dt1_haveIsDtlField2 = ("1".equals(fieldIdSubject2_isDtl) || "1".equals(fieldIdOrgType2_isDtl) || "1".equals(fieldIdOrgId2_isDtl) || "1".equals(fieldIdOccurdate2_isDtl)); dataMap.put("dt1_haveIsDtlField2", dt1_haveIsDtlField2 ? "true" : "false"); } else if ("advance".equals(fnaWfType)) {//预付款流程 if (Util.getIntValue(dtlNumber) == 1) { if (Util.getIntValue(fieldType) == 1) { dataMap.put("dt1_fieldIdYfkje_fieldId", fieldId);//1:借款金额; dataMap.put("dt1_fieldIdYfkje_fieldName", fieldName); dataMap.put(fieldId, "dt1_fieldIdYfkje_fieldId"); dataMap.put("dt1_fieldIdYfkje_fieldhtmltype", fieldhtmltype); dataMap.put("dt1_fieldIdYfkje_type", type); } else if (Util.getIntValue(fieldType) == 2) { dataMap.put("dt1_fieldIdYfkmx_fieldId", fieldId);//2:调整明细; dataMap.put("dt1_fieldIdYfkmx_fieldName", fieldName); dataMap.put(fieldId, "dt1_fieldIdYfkmx_fieldId"); dataMap.put("dt1_fieldIdYfkmx_fieldhtmltype", fieldhtmltype); dataMap.put("dt1_fieldIdYfkmx_type", type); } } } } try { //更新缓存 FnaWfSetCache.putFnaWfFieldSetMap(workflowid, fnaWfType, dataMap); } catch (Exception e) { new BaseBean().writeLog(e); } } return fnaWfType; } /** * 返回指定人员 、日期范围内,未还借款金额 * * @param userId * @param startDate * @param endDate * @return */ public static double getPersonalLoanAmount(int userId, String startDate, String endDate) { double personalLoanAmount = 0.00; RecordSet rs = new RecordSet(); String sql = "select SUM(fbi.amountBorrow * fbi.borrowDirection) sum_amountBorrow \n" + " from FnaBorrowInfo fbi \n" + " where 1=1 \n"; if (!"".equals(startDate)) { sql += " and fbi.createDate >= '" + StringEscapeUtils.escapeSql(startDate) + "' \n"; } if (!"".equals(endDate)) { sql += " and fbi.createDate <= '" + StringEscapeUtils.escapeSql(endDate) + "' \n"; } sql += " and fbi.applicantid = " + userId; rs.executeSql(sql); if (rs.next()) { personalLoanAmount = Util.getDoubleValue(rs.getString("sum_amountBorrow"), 0.00); } return personalLoanAmount; } /** * 流程表单上填写的费用日期 */ public final static String BudgetAutoMoveAfterOccurDate1 = "" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10003241, weaver.general.ThreadVarLanguage.getLang()) + ""; /** * 流程费用表中保存的费用日期 */ public final static String BudgetAutoMoveAfterOccurDate3 = "" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10003242, weaver.general.ThreadVarLanguage.getLang()) + ""; /** * 流程费用表中保存的结转前的费用日期 */ public final static String BudgetAutoMoveAfterOccurDate4 = "" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10003243, weaver.general.ThreadVarLanguage.getLang()) + ""; /** * 流程费用表记录是否发生过结转;1:结转过;其他:没有结转过; */ public final static String IsBudgetAutoMove = "" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10003244, weaver.general.ThreadVarLanguage.getLang()) + "1:" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10003245, weaver.general.ThreadVarLanguage.getLang()) + ""; /** * 获取报销流程相应费用明细费用日期相关信息
* BudgetAutoMoveAfterOccurDate1 = "流程表单上填写的费用日期";
* BudgetAutoMoveAfterOccurDate3 = "流程费用表中保存的费用日期";
* BudgetAutoMoveAfterOccurDate4 = "流程费用表中保存的结转前的费用日期";
* IsBudgetAutoMove = "流程费用表记录是否发生过结转;1:结转过;其他:没有结转过;"; * * @param occurdate 流程表单填写的费用日期 * @param dtl_id 流程费用明细数据库PkId * @param requestid 流程requestid * @param fnaExpenseInfoRecordHm * @return */ public static HashMap getBudgetAutoMoveAfterOccurDate(String occurdate, int dtl_id, int requestid, HashMap fnaExpenseInfoRecordHm) { return getBudgetAutoMoveAfterOccurDate(occurdate, "", dtl_id, requestid, fnaExpenseInfoRecordHm); } /** * 获取报销流程相应费用明细费用日期相关信息
* BudgetAutoMoveAfterOccurDate1 = "流程表单上填写的费用日期";
* BudgetAutoMoveAfterOccurDate3 = "流程费用表中保存的费用日期";
* BudgetAutoMoveAfterOccurDate4 = "流程费用表中保存的结转前的费用日期";
* IsBudgetAutoMove = "流程费用表记录是否发生过结转;1:结转过;其他:没有结转过;"; * * @param occurdate 流程表单填写的费用日期 * @param detailtable 流程费用明细表名。与参数dtl_id一并传入。 * @param dtl_id 流程费用明细数据库PkId * @param requestid 流程requestid * @param fnaExpenseInfoRecordHm * @return */ public static HashMap getBudgetAutoMoveAfterOccurDate(String occurdate, String detailtable, int dtl_id, int requestid, HashMap fnaExpenseInfoRecordHm) { HashMap retHm = new HashMap(); retHm.put(FnaCommon.BudgetAutoMoveAfterOccurDate1, occurdate); retHm.put(FnaCommon.BudgetAutoMoveAfterOccurDate3, ""); retHm.put(FnaCommon.BudgetAutoMoveAfterOccurDate4, ""); retHm.put(FnaCommon.IsBudgetAutoMove, "0"); if (dtl_id != 0 && requestid > 0) { if (fnaExpenseInfoRecordHm != null && fnaExpenseInfoRecordHm.containsKey("occurdate")) { String _occurdate = Util.null2String(fnaExpenseInfoRecordHm.get("occurdate")).trim(); String _occurdateOld = Util.null2String(fnaExpenseInfoRecordHm.get("occurdateOld")).trim(); String _isBudgetAutoMove = Util.getIntValue(fnaExpenseInfoRecordHm.get("isBudgetAutoMove"), 0) + ""; retHm.put(FnaCommon.BudgetAutoMoveAfterOccurDate3, _occurdate); retHm.put(FnaCommon.BudgetAutoMoveAfterOccurDate4, _occurdateOld); retHm.put(FnaCommon.IsBudgetAutoMove, _isBudgetAutoMove); } else { RecordSet rs = new RecordSet(); boolean isFound = false; //定位 数据库表名, 日期范围可能跨年 List list_out_FnaExpenseInfo = new ArrayList(); FnaSplitTableByYearComInfo.getFnaTableNameList(FnaTableNameEnum.FnaExpenseInfo, "1000-01-01", "9999-12-31", list_out_FnaExpenseInfo); //定位 数据库表名, 日期范围可能跨年 for (int aaaaaaaa = 0; aaaaaaaa < list_out_FnaExpenseInfo.size(); aaaaaaaa++) { String tableName_FnaExpenseInfo = list_out_FnaExpenseInfo.get(aaaaaaaa); String sql = ""; if (dtl_id > 0) {//不含有明细 == -987654321 if (detailtable == null || "".equals(detailtable)) { sql = "select a.occurdate, a.occurdateOld, a.isBudgetAutoMove \n" + " from " + tableName_FnaExpenseInfo + " a \n" + " where a.sourceRequestidDtlId = " + dtl_id + " and a.sourceRequestid = a.requestid and a.requestid = " + requestid; } else { //E9 先回归的拆表,再回归的多明细报销 try { boolean query_changeAmt_flag = rs.executeQuery(" select detailtable from " + tableName_FnaExpenseInfo + " where 1=2 "); if (!query_changeAmt_flag) { if ("oracle".equalsIgnoreCase(rs.getDBType())) { rs.execute(" alter table " + tableName_FnaExpenseInfo + " add detailtable VARCHAR2(200) "); } else if ("mysql".equalsIgnoreCase(rs.getDBType())) { rs.execute(" alter table " + tableName_FnaExpenseInfo + " add detailtable VARCHAR(200) "); } else { rs.execute(" alter table " + tableName_FnaExpenseInfo + " add detailtable VARCHAR(200) "); } } } catch (Exception ex1) { } sql = "select a.occurdate, a.occurdateOld, a.isBudgetAutoMove \n" + " from " + tableName_FnaExpenseInfo + " a \n" + " where a.detailtable = '" + StringEscapeUtils.escapeSql(detailtable) + "' and a.sourceRequestidDtlId = " + dtl_id + " and a.sourceRequestid = a.requestid and a.requestid = " + requestid; } } else { sql = "select a.occurdate, a.occurdateOld, a.isBudgetAutoMove \n" + " from " + tableName_FnaExpenseInfo + " a \n" + " where a.sourceRequestid = a.requestid and a.requestid = " + requestid; } rs.executeSql(sql); if (rs.next()) { isFound = true; //找到日期了,就跳出循环,不需要再查询后面的表了 String _occurdate = Util.null2String(rs.getString("occurdate")).trim(); String _occurdateOld = Util.null2String(rs.getString("occurdateOld")).trim(); String _isBudgetAutoMove = Util.getIntValue(rs.getString("isBudgetAutoMove"), 0) + ""; retHm.put(FnaCommon.BudgetAutoMoveAfterOccurDate3, _occurdate); retHm.put(FnaCommon.BudgetAutoMoveAfterOccurDate4, _occurdateOld); retHm.put(FnaCommon.IsBudgetAutoMove, _isBudgetAutoMove); } if (isFound) { break; } }//for end } } return retHm; } /** * 检查指定用户对指定预算单位是否有编辑权限 * * @param organizationtype * @param organizationid * @param userId * @return * @throws Exception */ public static boolean checkPermissionsFnaBudgetForEdit(String organizationtype, String organizationid, int userId) throws Exception { boolean fnaBudgetViewFlag = false; if ("0".equals(organizationtype)) { if (FnaBudgetLeftRuleSet.isAllowCmpEdit(userId)) { fnaBudgetViewFlag = true; } } else if ("1".equals(organizationtype)) { List allowOrgIdEdit_list = new ArrayList(); boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowSubCmpIdEdit(userId, allowOrgIdEdit_list); if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) { fnaBudgetViewFlag = true; } } else if ("2".equals(organizationtype)) { List allowOrgIdEdit_list = new ArrayList(); boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowDepIdEdit(userId, allowOrgIdEdit_list); if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) { fnaBudgetViewFlag = true; } } else if ("3".equals(organizationtype)) { List grList = new ArrayList(); grList.add(organizationid); List allowOrgIdEdit_list = new ArrayList(); boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowHrmIdEdit(userId, null, null, grList, allowOrgIdEdit_list); if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) { fnaBudgetViewFlag = true; } } else if ((FnaCostCenter.ORGANIZATION_TYPE + "").equals(organizationtype)) { List allowOrgIdEdit_list = new ArrayList(); boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowFccIdEdit(userId, allowOrgIdEdit_list); if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) { fnaBudgetViewFlag = true; } } return fnaBudgetViewFlag; } /** * 检查指定用户对指定预算单位是否有编辑权限 * * @param organizationtype * @param organizationid * @param userId * @return * @throws Exception */ public static boolean checkPermissionsFnaBudgetForView(String organizationtype, String organizationid, int userId) throws Exception { boolean fnaBudgetViewFlag = false; if ("0".equals(organizationtype)) { if (FnaBudgetLeftRuleSet.isAllowCmp(userId)) { fnaBudgetViewFlag = true; } } else if ("1".equals(organizationtype)) { List allowOrgIdEdit_list = new ArrayList(); boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowSubCmpId(userId, allowOrgIdEdit_list); if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) { fnaBudgetViewFlag = true; } } else if ("2".equals(organizationtype)) { List allowOrgIdEdit_list = new ArrayList(); boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowDepId(userId, allowOrgIdEdit_list); if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) { fnaBudgetViewFlag = true; } } else if ("3".equals(organizationtype)) { List grList = new ArrayList(); grList.add(organizationid); List allowOrgIdEdit_list = new ArrayList(); boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowHrmId(userId, null, null, grList, allowOrgIdEdit_list); if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) { fnaBudgetViewFlag = true; } } else if ((FnaCostCenter.ORGANIZATION_TYPE + "").equals(organizationtype)) { List allowOrgIdEdit_list = new ArrayList(); boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowFccId(userId, allowOrgIdEdit_list); if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) { fnaBudgetViewFlag = true; } } return fnaBudgetViewFlag; } /** * 检查字符串长度是否没有超过指定长度(字符串转换编码默认按UTF-8进行转换,一个双字节字符对应长度3) * * @param str 被检查的字符串 * @param maxLength 指定最大长度 * @return * @throws UnsupportedEncodingException */ public static boolean checkStringLength(String str, int maxLength) throws UnsupportedEncodingException { return checkStringLength(str, maxLength, "UTF-8"); } /** * 检查字符串长度是否没有超过指定长度 * * @param str 被检查的字符串 * @param maxLength 指定最大长度 * @param charsetName 字符串转换编码 * @return * @throws UnsupportedEncodingException */ public static boolean checkStringLength(String str, int maxLength, String charsetName) throws UnsupportedEncodingException { if (str == null || "".equals(str)) { return true; } else { return str.getBytes(charsetName).length < maxLength; } } /** * 更新oracle数据库clob类型字段值、更新sqlserver数据库text类型字段值的方法 * * @param tableName 表名 * @param clobFieldName clob、text类型字段数据库字段名 * @param colbFieldValue clob、text字段值 * @param keyFieldName 记录主键字段数据库字段名 * @param keyFieldValue 记录主键字段值 * @param keyFieldDbType 记录主键字段数据库字段类型:int、string * @return * @throws Exception */ public static boolean updateDbClobOrTextFieldValue(String tableName, String clobFieldName, String colbFieldValue, String keyFieldName, String keyFieldValue, String keyFieldDbType) throws Exception { //new BaseBean().writeLog("updateDbClobOrTextFieldValue colbFieldValue>>>"+colbFieldValue+";;;keyFieldValue>>>"+keyFieldValue); if ("int".equals(keyFieldDbType) || "string".equals(keyFieldDbType)) { } else { new Exception("FnaCommon.updateDbClobTextFieldValue:keyFieldDbType 记录主键字段数据库字段类型:int、string,该参数值不正确!"); } RecordSet rs = new RecordSet(); if ("oracle".equals(rs.getDBType()) && Util.null2String(rs.getOrgindbtype()).equals("oracle")) { boolean flag = false; boolean flag_exec_updateSql = false; ConnStatement statement = null; try { statement = new ConnStatement(); String sql = "update " + tableName + " " + " set " + clobFieldName + " = empty_clob() " + " where " + keyFieldName + " = ?"; //new BaseBean().writeLog(sql); statement.setStatementSql(sql); if ("int".equals(keyFieldDbType)) { statement.setInt(1, Util.getIntValue(keyFieldValue, -1)); } else { statement.setString(1, keyFieldValue); } statement.executeUpdate(); sql = "select " + clobFieldName + " from " + tableName + " where " + keyFieldName + " = "; if ("int".equals(keyFieldDbType)) { sql += Util.getIntValue(keyFieldValue, -1); } else { sql += "'" + StringEscapeUtils.escapeSql(keyFieldValue) + "'"; } //new BaseBean().writeLog(sql); statement.setStatementSql(sql, false); statement.executeQuery(); if (statement.next()) { // String(this.doccontent.getBytes("ISO8859_1"), // "UTF-8")) ; char[] _writeCharArray = Util.null2String(colbFieldValue).toCharArray(); CLOB theclob = statement.getClob(1); if (theclob != null) { Writer _write = theclob.getCharacterOutputStream(); if (_write != null) { try { _write.write(_writeCharArray); } finally { try { if (_write != null) { _write.flush(); } } catch (Exception ex01) { } try { if (_write != null) { _write.close(); } } catch (Exception ex01) { } } flag = true; } else { flag_exec_updateSql = true; } } else { flag_exec_updateSql = true; } } } finally { try { if (statement != null) { statement.close(); } } catch (Exception ex) { new BaseBean().writeLog("fna_FnaCommon_Exception:" + ex); } } if (flag_exec_updateSql) { String sql = "update " + tableName + " " + " set " + clobFieldName + " = ? " + " where " + keyFieldName + " = ?"; return rs.executeUpdate(sql, Util.null2String(colbFieldValue), keyFieldValue + ""); } return flag; } else { /*String sql = "update "+tableName+" " + " set "+clobFieldName+" = ? " + " where "+keyFieldName+" = ?"; return rs.executeUpdate(sql, Util.null2String(colbFieldValue), keyFieldValue+"");*/ ConnStatement connStatement = new ConnStatement(); try { String sql = "update " + tableName + " " + " set " + clobFieldName + " = ? " + " where " + keyFieldName + " = ?"; connStatement.setStatementSql(sql); connStatement.setString(1, Util.null2String(colbFieldValue)); connStatement.setString(2, keyFieldValue); connStatement.executeUpdate(); return true; } catch (Exception e) { new BaseBean().writeLog("fna_FnaCommon_Exception:" + e.getMessage()); return false; } finally { connStatement.close(); } } } /** * 深复制List * * @param list1 * @return */ public static List copyList_stringArray(List list1) { List list2 = new ArrayList(); if (list1 != null) { int list1Len = list1.size(); for (int i = 0; i < list1Len; i++) { String[] arr1 = list1.get(i); if (arr1 != null) { int arr1Len = arr1.length; String[] arr2 = new String[arr1Len]; for (int j = 0; j < arr1Len; j++) { arr2[j] = arr1[j]; } list2.add(arr2); } else { list2.add(null); } } } else { return null; } return list2; } /** * 深复制List * * @param list1 * @return */ public static List copyList_string(List list1) { List list2 = new ArrayList(); if (list1 != null) { int list1Len = list1.size(); for (int i = 0; i < list1Len; i++) { list2.add(list1.get(i)); } } else { return null; } return list2; } /** * 复制List * * @param list1 源list,待复制的 * @param list2 被复制的,复制前会调用clear函数,清除原有数据。 */ public void copyList_string(List list1, List list2) { //List list2 = new ArrayList(); if (list1 != null && list2 != null) { list2.clear(); int list1Len = list1.size(); for (int i = 0; i < list1Len; i++) { list2.add(list1.get(i)); } } } /** * 获得GUID * * @return 32位长度,无符号-,其中英文字符随机大小写 */ public static String getPrimaryKeyGuid1() { int max = 10; int min = 1; Random random = new Random(); String uuid1 = UUID.randomUUID().toString().replaceAll("-", ""); StringBuffer guid1 = new StringBuffer(); String[] uuid1Array = uuid1.split(""); for (int i = 0; i < uuid1Array.length; i++) { int s = random.nextInt(max) % (max - min + 1) + min; if (s < 6) { guid1.append(uuid1Array[i]); } else { guid1.append(uuid1Array[i].toUpperCase()); } } return Util.null2String(guid1.toString()).trim(); } /** * 报销费用类型(科目)、成本中心浏览框支持流程浏览数据定义 * * @param params 参数键值对 * @param operation add/del * @return */ public boolean saveOrUpdateWfBrowdef(Map params, String operation) { try { String workflowid = Util.null2String(params.get("workflowId")); String fieldId = Util.null2String(params.get("fieldId")); String viewType = Util.null2String(params.get("viewType")); String fieldType = Util.null2String(params.get("fieldType")); String title = Util.null2String(params.get("title")); String feetypeRange = Util.null2String(params.get("feetypeRange")); String fccId = Util.null2String(params.get("fccId")); String param = !feetypeRange.equals("") ? feetypeRange : fccId; /*new BaseBean().writeLog("workflowid:"+workflowid); new BaseBean().writeLog("fieldId:"+fieldId); new BaseBean().writeLog("viewType:"+viewType); new BaseBean().writeLog("fieldType:"+fieldType); new BaseBean().writeLog("title:"+ new String(title.getBytes("ISO-8859-1"),"utf-8")); new BaseBean().writeLog("feetypeRange:"+feetypeRange); new BaseBean().writeLog("fccId:"+fccId);*/ if (operation.equals("del")) { removeWfBrowdef(workflowid, fieldId, fieldType); } else if (operation.equals("add")) { removeWfBrowdef(workflowid, fieldId, fieldType); initNewWfBrowdef(workflowid, fieldId, viewType, fieldType, title, param); } BudgetfeeTypeComInfo budgetfeeTypeComInfo = new BudgetfeeTypeComInfo(); budgetfeeTypeComInfo.removeBudgetfeeTypeCache(); return true; } catch (Exception e) { new BaseBean().writeLog(e); return false; } } /** * 删除 流程浏览数据定义 * * @param workflowid 流程id * @param fieldId 字段id * @param fieldType 浏览按钮类型 */ private void removeWfBrowdef(String workflowid, String fieldId, String fieldType) throws Exception { String sql = ""; RecordSet rs = new RecordSet(); RecordSet rs2 = new RecordSet(); //删除历史数据 sql = "select id from FnaFeetypeWfbrowdef " + " where workflowid=" + workflowid + " and fieldId=" + fieldId + " and fieldType=" + fieldType; rs.executeSql(sql); if (rs.next()) { String tempid = Util.null2String(rs.getString("id")); sql = "delete from FnaFeetypeWfbrowdef where id=" + tempid; rs2.executeSql(sql); sql = "delete from FnaFeetypeWfbrowdef_dt1 where mainid=" + tempid; rs2.executeSql(sql); } } /** * 流程浏览数据定义 * * @param workflowid 流程id * @param fieldId 字段id * @param viewType * @param fieldType 浏览按钮类型 * @param title 标题 * @param param 参数键值对 */ private void initNewWfBrowdef(String workflowid, String fieldId, String viewType, String fieldType, String title, String param) throws Exception { String sql = ""; RecordSet rs = new RecordSet(); sql = "insert into FnaFeetypeWfbrowdef (workflowid,fieldId,viewType,fieldType,title) " + " values " + " (" + workflowid + "," + fieldId + "," + viewType + "," + fieldType + ",'" + title + "')"; rs.executeSql(sql); //插入新数据 String id = ""; sql = "select max(id) maxid from FnaFeetypeWfbrowdef"; rs.executeSql(sql); if (rs.next()) { id = Util.null2String(rs.getString("maxid")); } if (!param.equals("") && !id.equals("")) { for (String refid : param.split(",")) { sql = "insert into FnaFeetypeWfbrowdef_dt1 (mainid,refid)" + " values " + " (" + id + "," + refid + ")"; rs.executeSql(sql); } } } /** * 返回:路径设置》浏览按钮定义:中定义的可见科目 * * @param workflowid * @param fieldId * @param fieldType 浏览按钮类型 * @return */ public List getWfBrowdefList(String workflowid, String fieldId, String fieldType) { try { String sql = ""; RecordSet rs = new RecordSet(); List returnList = new ArrayList(); sql = "select * from FnaFeetypeWfbrowdef_dt1 where mainid = " + "(" + " select id from FnaFeetypeWfbrowdef " + " where workflowid=" + Util.getIntValue(workflowid) + " and fieldId=" + Util.getIntValue(fieldId) + " and fieldType=" + Util.getIntValue(fieldType) + ") " + "order by id "; rs.executeSql(sql); while (rs.next()) { returnList.add(Util.null2String(rs.getString("refId"))); } return returnList; } catch (Exception e) { new BaseBean().writeLog(e); return null; } } /** * Rsa加密支持中文和长字符(不推荐长字符加密/解密会很慢);与doFnaDecrypt配套使用 * * @param str 需要进行加密的明文 * @return 加密后的字符串密文 */ public String doFnaEncrypt(String str) { return this.doFnaEncrypt(str, Des.KEY1, Des.KEY2, Des.KEY3); } /** * Rsa加密支持中文和长字符(不推荐长字符加密/解密会很慢);与doFnaDecrypt配套使用 * * @param str 需要进行加密的明文 * @param key1 Des.KEY1 * @param key2 Des.KEY2 * @param key3 Des.KEY3 * @return 加密后的字符串密文 */ public String doFnaEncrypt(String str, String key1, String key2, String key3) { Des desObj = new Des(); String pwd_des = desObj.strEnc(str, key1, key2, key3); int len = pwd_des.length(); StringBuffer tmp_pwd_des = new StringBuffer(); while (len > 100) { String _s = pwd_des.substring(0, 100); tmp_pwd_des.append(RSAUtils.encryptString(_s)).append(" "); pwd_des = pwd_des.substring(100); len = pwd_des.length(); } if (len > 0) { tmp_pwd_des.append(RSAUtils.encryptString(pwd_des)).append(" "); } return tmp_pwd_des.toString(); } /** * Rsa解密支持中文和长字符(不推荐长字符加密/解密会很慢);与doFnaEncrypt配套使用 * * @param str * @return 解密后的字符串明文 */ public String doFnaDecrypt(String str) { return this.doFnaDecrypt(str, Des.KEY1, Des.KEY2, Des.KEY3); } /** * Rsa解密支持中文和长字符(不推荐长字符加密/解密会很慢);与doFnaEncrypt配套使用 * * @param str 加密后的字符串密文 * @param key1 Des.KEY1 * @param key2 Des.KEY2 * @param key3 Des.KEY3 * @return 解密后的字符串明文 */ public String doFnaDecrypt(String str, String key1, String key2, String key3) { StringBuffer descrypedStr = new StringBuffer(""); String[] encrypedStrArray = str.trim().split(" "); int encrypedStrArrayLen = encrypedStrArray.length; for (int i = 0; i < encrypedStrArrayLen; i++) { String _str = Util.null2String(encrypedStrArray[i]).trim(); String _descrypedStr = ""; if (!"".equals(_str)) { _descrypedStr = RSAUtils.decryptString(_str); } descrypedStr.append(_descrypedStr); } Des desObj = new Des(); return desObj.strDec(descrypedStr.toString(), key1, key2, key3); } /** * Rsa解密支持中文和长字符(不推荐长字符加密/解密会很慢); * * @param str * @return 解密后的字符串明文 */ public String doFnaDecrypt1(String str) { return this.doFnaDecrypt1(str, Des.KEY1, Des.KEY2, Des.KEY3); } /** * Rsa解密支持中文和长字符(不推荐长字符加密/解密会很慢);配合js加密使用:/fna/js/e8Common_wev8.js中的函数doFnaEncryptRsa1() * * @param str /fna/js/e8Common_wev8.js中的函数doFnaEncryptRsa1() 加密后的字符串密文 * @param key1 Des.KEY1 * @param key2 Des.KEY2 * @param key3 Des.KEY3 * @return 解密后的字符串明文 */ public String doFnaDecrypt1(String str, String key1, String key2, String key3) { StringBuffer descrypedStr = new StringBuffer(""); String[] encrypedStrArray = str.trim().split(" "); int encrypedStrArrayLen = encrypedStrArray.length; for (int i = 0; i < encrypedStrArrayLen; i++) { String _str = Util.null2String(encrypedStrArray[i]).trim(); String _descrypedStr = ""; if (!"".equals(_str)) { _descrypedStr = RSAUtils.decryptStringByJs(_str); } descrypedStr.append(_descrypedStr); } Des desObj = new Des(); return desObj.strDec(descrypedStr.toString(), key1, key2, key3); } /** * 将Object对象序列化成字符串 * * @param obj * @return * @throws Exception */ public String serialDoc2Str(Object obj) throws Exception { ByteArrayOutputStream byteArrayOutputStream = null; ObjectOutputStream objectOutputStream = null; try { byteArrayOutputStream = new ByteArrayOutputStream(); objectOutputStream = new ObjectOutputStream(byteArrayOutputStream); objectOutputStream.writeObject(obj); String serStr = byteArrayOutputStream.toString("ISO-8859-1"); serStr = java.net.URLEncoder.encode(serStr, "UTF-8"); return serStr; } finally { try { if (objectOutputStream != null) { IOUtils.closeQuietly(objectOutputStream); } } catch (Exception ex) { } try { if (byteArrayOutputStream != null) { IOUtils.closeQuietly(byteArrayOutputStream); } } catch (Exception ex) { } } } /** * 将字符串序列化成Object对象 * * @param serStr * @return * @throws Exception */ public Object serialStr2Doc(String serStr) throws Exception { ByteArrayInputStream byteArrayInputStream = null; ObjectInputStream objectInputStream = null; try { String redStr = java.net.URLDecoder.decode(serStr, "UTF-8"); byteArrayInputStream = new ByteArrayInputStream(redStr.getBytes("ISO-8859-1")); //objectInputStream = new ObjectInputStream(byteArrayInputStream); objectInputStream = SecurityMethodUtil.getSafeObjectInputStream(byteArrayInputStream); return (Object) objectInputStream.readObject(); } finally { try { if (objectInputStream != null) { IOUtils.closeQuietly(objectInputStream); } } catch (Exception ex) { } try { if (byteArrayInputStream != null) { IOUtils.closeQuietly(byteArrayInputStream); } } catch (Exception ex) { } } } /** * 释放 系统表单:预算审批流转单 对应的预算审批中版本(从审批中修改为草稿版本,修改成草稿版本前会删除当前的草稿版本) * * @param requestid */ public void releaseBillFnaBudget(int requestid) { RecordSet rs_1 = new RecordSet(); RecordSet rs_2 = new RecordSet(); RecordSet rs_3 = new RecordSet(); List budgetid_list = new ArrayList(); String sql = "select fnayear,budgetdetail " + " from bill_FnaBudget " + " where budgetdetail is not null " + " and requestid = " + requestid + " " + " order by id desc"; rs_1.executeSql(sql); while (rs_1.next()) { int fnayear = Util.getIntValue(rs_1.getString("fnayear"));//年份 int budgetid = Util.getIntValue(rs_1.getString("budgetdetail")); //TODO 定位 数据库表名 String tableName_FnaBudgetInfo = FnaSplitTableByYearComInfo.getFnaTableNameByYear(FnaTableNameEnum.FnaBudgetInfo, fnayear); if (budgetid > 0 && !budgetid_list.contains(String.valueOf(tableName_FnaBudgetInfo + "_" + budgetid))) { budgetid_list.add(String.valueOf(tableName_FnaBudgetInfo + "_" + budgetid));//每张表的ID都是自增长的,所以需要拼接表名区分ID来源 String sql0 = "select organizationtype, budgetorganizationid, budgetperiods, status " + " from " + tableName_FnaBudgetInfo + " " + " where id=" + budgetid; rs_2.executeSql(sql0); if (rs_2.next()) { int _organizationtype = rs_2.getInt("organizationtype"); int _budgetorganizationid = rs_2.getInt("budgetorganizationid"); int _budgetperiods = rs_2.getInt("budgetperiods"); int _status = rs_2.getInt("status"); if (_status == 3) {//只有当当前预算信息版本还是审批中的时候才需要进行后续操作 if (_organizationtype > 0 && _budgetorganizationid > 0 && _budgetperiods > 0) { BudgetHandler.deleteFnaBudgetInfoAndFnaBudgetInfoDetail(_organizationtype, _budgetorganizationid, _budgetperiods, 0); String sql1 = "update " + tableName_FnaBudgetInfo + " set status = 0, revision = 0 where id=" + budgetid; rs_3.executeSql(sql1); } } } } } } /** * 生效 系统表单:预算审批流转单 对应的预算审批中版本(从审批中修改为生效版本) * * @param requestid * @throws Exception */ public void effectBillFnaBudget(int requestid) throws Exception { RecordSet rs_1 = new RecordSet(); //update to new revision String sql = "select a.id, a.fnayear, a.budgetdetail, b.creater\n" + " from bill_FnaBudget a\n" + " join workflow_requestbase b on a.requestid = b.requestid\n" + " where a.budgetdetail is not null\n" + " and a.requestid = ? \n" + " order by a.id desc"; rs_1.executeQuery(sql, requestid); if (rs_1.next()) { int fnayear = Util.getIntValue(rs_1.getString("fnayear"));//年份 int budgetid = Util.getIntValue(rs_1.getString("budgetdetail")); int creater = Util.getIntValue(rs_1.getString("creater")); if (budgetid > 0) { RecordSet rs = new RecordSet(); //TODO 定位 数据库表名 String tableName_FnaBudgetInfo = FnaSplitTableByYearComInfo.getFnaTableNameByYear(FnaTableNameEnum.FnaBudgetInfo, fnayear); User user = new UserManager().getUserByUserIdAndLoginType(creater, "1"); String currentdate = TimeUtil.getCurrentDateString(); String inusefnabudgetinfoid = ""; String orgId = "0"; String orgType = "0"; int budgetperiods = 0; sql = "select budgetorganizationid, organizationtype, budgetperiods, revision, status \n" + " from " + tableName_FnaBudgetInfo + " a\n" + " where id = ? \n"; rs.executeQuery(sql, budgetid); if (rs.next()) { orgId = Util.null2String(rs.getString("budgetorganizationid")).trim(); orgType = Util.null2String(rs.getString("organizationtype")).trim(); budgetperiods = Util.getIntValue(rs.getString("budgetperiods"), 0); int revision = Util.getIntValue(rs.getString("revision"), 0); int _status = rs.getInt("status"); if (_status == 3) {//只有当当前预算信息版本还是审批中的时候才需要进行后续操作 if (revision > 0) { sql = "select max(revision) max_revision \n" + " from " + tableName_FnaBudgetInfo + " a\n" + " where a.status in (1,2) \n" + " and a.revision < ?\n" + " and a.organizationtype = ?\n" + " and a.budgetperiods = ?" + " and a.budgetorganizationid = ?\n"; rs.executeQuery(sql, revision, orgType, budgetperiods, orgId); if (rs.next()) { revision = Util.getIntValue(rs.getString("max_revision"), 0); if (revision > 0) { sql = "select a.id \n" + " from " + tableName_FnaBudgetInfo + " a\n" + " where a.status in (1,2) \n" + " and a.revision = ?\n" + " and a.organizationtype = ?\n" + " and a.budgetperiods = ?\n" + " and a.budgetorganizationid = ?"; rs.executeQuery(sql, revision, orgType, budgetperiods, orgId); if (rs.next()) { inusefnabudgetinfoid = Util.null2String(rs.getString("id")).trim(); } } } } BudgetApproveWFHandler handler = new BudgetApproveWFHandler(); handler.changeBudgetRevison(budgetid, 1, budgetperiods); BudgetHandler.fnaBudgetInfoReverseInput(1, budgetid + "", inusefnabudgetinfoid, orgId, orgType, budgetperiods, currentdate, user); } } } } } /** * 特殊处理(费用流程,在强制归档时,同时,已经配置生效、释放冻结预算)
* 145257 解决借款流程强制归档触发action逻辑错误的问题
* 1、强制删除、强制收回(收回至)创建节点、强制归档(选择成归档时释放预算)
* 系统表单、e7方式配置的费用流程、e8方式配置的费用流程(借款、还款、报销):释放借款、释放预算
* 2、强制归档(选择成归档时生效预算)
* 1)系统表单、e7方式配置的费用流程:生效审批中的费用,如果流程没有审批中费用,则不产生已发送费用
* 2)e8方式配置的费用流程(借款、还款、报销):
* 借款:流程节点中有配置过action.FnaBorrowEffectNew,则会产生借款(重新生成数据)
* 还款:流程节点中有配置过action.fnaBorrowReverseNew,则会产生还款(重新生成数据)
* 报销:
* 流程节点中有配置过action.fnaBorrowReverseNew,则会产生还款(重新生成数据)
* 流程节点中有配置过action.WorkflowFnaInWorkflowNew,则会产生审批中预算(重新生成数据)
* 流程节点中有配置过action.WorkflowFnaEffectNew,则会产生已发送预算(生效审批中数据)
* 流程节点中有配置过action.FnaChangeEffectNew,则会生效变更
* 流程节点中有配置过action.FnaShareEffectNew,则会生效分摊
* 系统表单:预算审批流转单 生效释放操作 * * @param requestid 流程requestid * @param wfForceOverLogic 该参数的业务逻辑只有当流程处于归档节点才生效; 0:走删除逻辑;1:走生效逻辑; * @param forceDelete true:无视流程所处节点,无视流程是否已经被删除,强制走删除逻辑(无视参数:wfForceOverLogic); */ public void doWfForceOver(int requestid, int wfForceOverLogic, boolean forceDelete) { // new BaseBean().writeLog("doWfForceOver requestid="+requestid+";wfForceOverLogic="+wfForceOverLogic+";forceDelete="+forceDelete+";"); RecordSet rs_1 = new RecordSet(); int currentnodetype = -1; if (forceDelete) { } else { String fnasql = "select currentnodetype from workflow_requestbase where requestid = " + requestid; rs_1.executeSql(fnasql); if (rs_1.next()) { currentnodetype = rs_1.getInt("currentnodetype"); } } //流程退回创建节点或者删除流程 if (currentnodetype == 0 || (forceDelete && wfForceOverLogic == 0)) { try { //初始化发票状态 FnaInvoiceCommon fnaInvoiceCommon = new FnaInvoiceCommon(); fnaInvoiceCommon.doWfForceOver(requestid); } catch (Exception ex1) { } } if (currentnodetype == 3 || (forceDelete && wfForceOverLogic == 0)) { if (wfForceOverLogic == 0) { try { //多维度上报,将当前审批流程中关联的C节点的状态修改成【草稿】,更新填报主表中的审批流程requestid为0 TemplateFillReportBizNew ReportBiz = new TemplateFillReportBizNew(); ReportBiz.updateStatusAndRequestid(requestid); } catch (Exception ex1) { } try { FnaAdvanceAmountControl fnaAdvanceAmountControl = new FnaAdvanceAmountControl(); fnaAdvanceAmountControl.delFnaAdvanceInfoHaveLog(requestid); } catch (Exception ex1) { } try { FnaBorrowAmountControl fnaBorrowAmountControl = new FnaBorrowAmountControl(); fnaBorrowAmountControl.delFnaBorrowInfoHaveLog(requestid); } catch (Exception ex1) { } try { FnaAmountControl fnaAmountControl = new FnaAmountControl(); fnaAmountControl.delFnaExpenseInfo(requestid); } catch (Exception ex1) { } try { FnaChangeAmountControl control = new FnaChangeAmountControl(); control.delFnaExpenseInfo(requestid); } catch (Exception ex1) { } try { FnaShareAmountControl control = new FnaShareAmountControl(); control.delFnaExpenseInfo(requestid); } catch (Exception ex1) { } try { this.releaseBillFnaBudget(requestid); } catch (Exception ex1) { } try { //释放(全面预算) FnaReleaseBudget fnaReleaseBudget = new FnaReleaseBudget(); fnaReleaseBudget.releaseBudget(requestid); } catch (Exception ex1) { } try { //还原预算填报的变更流程数据 new BaseBean().writeLog("doWfForceOver1111111111111111111111111111111111111111111111"); FnaReimbursementUtils fnaReimbursementUtils = new FnaReimbursementUtils(); fnaReimbursementUtils.delOldRequestEffectChangData(requestid); } catch (Exception ex1) { } } else if (wfForceOverLogic == 1) { String fnaWfType = ""; boolean fnaWfTypeEnable = false; rs_1.executeSql("select b.fnaWfType, b.enable " + " from workflow_requestbase a " + " join fnaFeeWfInfo b on a.workflowid = b.workflowid " + " where a.requestid = " + requestid); if (rs_1.next()) { fnaWfType = Util.null2String(rs_1.getString("fnaWfType")).trim(); fnaWfTypeEnable = (rs_1.getInt("enable") == 1); } int formid = 0; int _workflowid = 0; rs_1.executeSql("select a.workflowid, b.formid " + " from workflow_requestbase a " + " join workflow_base b on a.workflowid = b.id " + " where a.requestid = " + requestid); if (rs_1.next()) { _workflowid = rs_1.getInt("workflowid"); formid = rs_1.getInt("formid"); } if (!"".equals(fnaWfType)) {//是e8后台配置的某一类费用流程 if (fnaWfTypeEnable) {//启用了的费用流程 if ("advance".equals(fnaWfType)) {//是e8后台配置的预付款流程 RequestService requestService = new RequestService(); //扣除-节点前附加操作 String deductAdvanceNode1Ids = FnaWfSet.getActionSet4Wf(_workflowid, "deductAdvanceNode1Ids"); //扣除-节点后附加操作 String deductAdvanceNode2Ids = FnaWfSet.getActionSet4Wf(_workflowid, "deductAdvanceNode2Ids"); //扣除-出口附加操作 String deductAdvanceNode3Ids = FnaWfSet.getActionSet4Wf(_workflowid, "deductAdvanceNode3Ids"); //配置了生成借款的action(FnaAdvanceEffectNew) if (!"".equals(deductAdvanceNode1Ids) || !"".equals(deductAdvanceNode2Ids) || !"".equals(deductAdvanceNode3Ids)) { RequestInfo requestInfo = requestService.getRequest(requestid); requestInfo.getRequestManager().setSrc("submit"); requestInfo.getRequestManager().setFormid(formid); FnaAdvanceEffectNew fnaAdvanceEffectNew = new FnaAdvanceEffectNew(); fnaAdvanceEffectNew.execute(requestInfo); } } else if ("borrow".equals(fnaWfType)) {//是e8后台配置的借款流程 RequestService requestService = new RequestService(); //扣除-节点前附加操作 String deductBorrowNode1Ids = FnaWfSet.getActionSet4Wf(_workflowid, "deductBorrowNode1Ids"); //扣除-节点后附加操作 String deductBorrowNode2Ids = FnaWfSet.getActionSet4Wf(_workflowid, "deductBorrowNode2Ids"); //扣除-出口附加操作 String deductBorrowNode3Ids = FnaWfSet.getActionSet4Wf(_workflowid, "deductBorrowNode3Ids"); //配置了生成借款的action(FnaBorrowEffectNew) if (!"".equals(deductBorrowNode1Ids) || !"".equals(deductBorrowNode2Ids) || !"".equals(deductBorrowNode3Ids)) { RequestInfo requestInfo = requestService.getRequest(requestid); requestInfo.getRequestManager().setSrc("submit"); requestInfo.getRequestManager().setFormid(formid); FnaBorrowEffectNew fnaBorrowEffectNew = new FnaBorrowEffectNew(); fnaBorrowEffectNew.execute(requestInfo); } } else if ("repayment".equals(fnaWfType)) {//是e8后台配置的还款流程 RequestService requestService = new RequestService(); //冲销借款-节点前附加操作 String repaymentBorrowNode1Ids = FnaWfSet.getActionSet4Wf(_workflowid, "repaymentBorrowNode1Ids"); //冲销借款-节点后附加操作 String repaymentBorrowNode2Ids = FnaWfSet.getActionSet4Wf(_workflowid, "repaymentBorrowNode2Ids"); //冲销借款-出口附加操作 String repaymentBorrowNode3Ids = FnaWfSet.getActionSet4Wf(_workflowid, "repaymentBorrowNode3Ids"); //配置了冲销借款的action(FnaBorrowReverseNew) if (!"".equals(repaymentBorrowNode1Ids) || !"".equals(repaymentBorrowNode2Ids) || !"".equals(repaymentBorrowNode3Ids)) { RequestInfo requestInfo = requestService.getRequest(requestid); requestInfo.getRequestManager().setSrc("submit"); requestInfo.getRequestManager().setFormid(formid); FnaBorrowReverseNew fnaBorrowReverseNew = new FnaBorrowReverseNew(); fnaBorrowReverseNew.execute(requestInfo); } } else if ("fnaFeeWf".equals(fnaWfType)) {//是e8后台配置的报销流程 RequestService requestService = new RequestService(); //冲销借款-节点前附加操作 String repaymentBorrowNode1Ids = FnaWfSet.getActionSet4Wf(_workflowid, "repaymentBorrowNode1Ids"); //冲销借款-节点后附加操作 String repaymentBorrowNode2Ids = FnaWfSet.getActionSet4Wf(_workflowid, "repaymentBorrowNode2Ids"); //冲销借款-出口附加操作 String repaymentBorrowNode3Ids = FnaWfSet.getActionSet4Wf(_workflowid, "repaymentBorrowNode3Ids"); //配置了冲销借款的action(fnaBorrowReverseNew) if (!"".equals(repaymentBorrowNode1Ids) || !"".equals(repaymentBorrowNode2Ids) || !"".equals(repaymentBorrowNode3Ids)) { RequestInfo requestInfo = requestService.getRequest(requestid); requestInfo.getRequestManager().setSrc("submit"); requestInfo.getRequestManager().setFormid(formid); FnaBorrowReverseNew fnaBorrowReverseNew = new FnaBorrowReverseNew(); fnaBorrowReverseNew.execute(requestInfo); } //冻结-节点前附加操作 String frozeNode1Ids = FnaWfSet.getActionSet4Wf(_workflowid, "frozeNode1Ids"); //冻结-节点后附加操作 String frozeNode2Ids = FnaWfSet.getActionSet4Wf(_workflowid, "frozeNode2Ids"); //冻结-出口附加操作 String frozeNode3Ids = FnaWfSet.getActionSet4Wf(_workflowid, "frozeNode3Ids"); //配置了冻结预算的action(workflowFnaInWorkflowNew) if ((!"".equals(frozeNode1Ids) || !"".equals(frozeNode2Ids) || !"".equals(frozeNode3Ids))) { RequestInfo requestInfo = requestService.getRequest(requestid); requestInfo.getRequestManager().setSrc("submit"); requestInfo.getRequestManager().setFormid(formid); WorkflowFnaInWorkflowNew workflowFnaInWorkflowNew = new WorkflowFnaInWorkflowNew(); workflowFnaInWorkflowNew.execute(requestInfo); } //扣除-节点前附加操作 String deductNode1Ids = FnaWfSet.getActionSet4Wf(_workflowid, "deductNode1Ids"); //扣除-节点后附加操作 String deductNode2Ids = FnaWfSet.getActionSet4Wf(_workflowid, "deductNode2Ids"); //扣除-出口附加操作 String deductNode3Ids = FnaWfSet.getActionSet4Wf(_workflowid, "deductNode3Ids"); //配置了扣除预算的action(WorkflowFnaEffectNew) if (!"".equals(deductNode1Ids) || !"".equals(deductNode2Ids) || !"".equals(deductNode3Ids)) { RequestInfo requestInfo = requestService.getRequest(requestid); requestInfo.getRequestManager().setSrc("submit"); requestInfo.getRequestManager().setFormid(formid); WorkflowFnaEffectNew workflowFnaEffectNew = new WorkflowFnaEffectNew(); workflowFnaEffectNew.execute(requestInfo); } //扣除-节点前附加操作 String repaymentAdvanceNode1Ids = FnaWfSet.getActionSet4Wf(_workflowid, "repaymentAdvanceNode1Ids"); //扣除-节点后附加操作 String repaymentAdvanceNode2Ids = FnaWfSet.getActionSet4Wf(_workflowid, "repaymentAdvanceNode2Ids"); //扣除-出口附加操作 String repaymentAdvanceNode3Ids = FnaWfSet.getActionSet4Wf(_workflowid, "repaymentAdvanceNode3Ids"); //配置了冲销预付款的action(FnaAdvanceReverseNew) if (!"".equals(repaymentAdvanceNode1Ids) || !"".equals(repaymentAdvanceNode2Ids) || !"".equals(repaymentAdvanceNode3Ids)) { RequestInfo requestInfo = requestService.getRequest(requestid); requestInfo.getRequestManager().setSrc("submit"); requestInfo.getRequestManager().setFormid(formid); FnaAdvanceReverseNew fnaAdvanceReverseNew = new FnaAdvanceReverseNew(); fnaAdvanceReverseNew.execute(requestInfo); } } else if ("change".equals(fnaWfType)) {//是e8后台配置的预算变更流程 RequestService requestService = new RequestService(); String effectChangeNode1Ids = FnaWfSet.getActionSet4Wf(_workflowid, "effectChangeNode1Ids"); String effectChangeNode2Ids = FnaWfSet.getActionSet4Wf(_workflowid, "effectChangeNode2Ids"); String effectChangeNode3Ids = FnaWfSet.getActionSet4Wf(_workflowid, "effectChangeNode3Ids"); if (!"".equals(effectChangeNode1Ids) || !"".equals(effectChangeNode2Ids) || !"".equals(effectChangeNode3Ids)) { RequestInfo requestInfo = requestService.getRequest(requestid); requestInfo.getRequestManager().setSrc("submit"); requestInfo.getRequestManager().setFormid(formid); FnaChangeEffectNew fnaChangeEffectNew = new FnaChangeEffectNew(); fnaChangeEffectNew.execute(requestInfo); } } else if ("share".equals(fnaWfType)) {//是e8后台配置的费用分摊流程 RequestService requestService = new RequestService(); String effectShareNode1Ids = FnaWfSet.getActionSet4Wf(_workflowid, "effectShareNode1Ids"); String effectShareNode2Ids = FnaWfSet.getActionSet4Wf(_workflowid, "effectShareNode2Ids"); String effectShareNode3Ids = FnaWfSet.getActionSet4Wf(_workflowid, "effectShareNode3Ids"); if (!"".equals(effectShareNode1Ids) || !"".equals(effectShareNode2Ids) || !"".equals(effectShareNode3Ids)) { RequestInfo requestInfo = requestService.getRequest(requestid); requestInfo.getRequestManager().setSrc("submit"); requestInfo.getRequestManager().setFormid(formid); FnaShareEffectNew fnaShareEffectNew = new FnaShareEffectNew(); fnaShareEffectNew.execute(requestInfo); } } } } else {//其他不是e8后台配置的费用流程统一处理,只将当前流程插入费用表的费用数据置为已发送状态,如果当前流程没有往费用表写如果费用数据,则什么都不做 //定位 数据库表名, 日期范围可能跨年 List list_out_FnaExpenseInfo = new ArrayList(); FnaSplitTableByYearComInfo.getFnaTableNameList(FnaTableNameEnum.FnaExpenseInfo, "1000-01-01", "9999-12-31", list_out_FnaExpenseInfo); //定位 数据库表名, 日期范围可能跨年 for (int aaaaaaaa = 0; aaaaaaaa < list_out_FnaExpenseInfo.size(); aaaaaaaa++) { String tableName_FnaExpenseInfo = list_out_FnaExpenseInfo.get(aaaaaaaa); rs_1.executeSql("update " + tableName_FnaExpenseInfo + " set status=1 where requestid=" + requestid); }//for end } try { this.effectBillFnaBudget(requestid); } catch (Exception ex1) { } //生效(全面预算) try { String frozeNode1Ids = FnaWorkflowUtil.getActionSet4MulWf(_workflowid, "mulFrozeNode1Ids"); String frozeNode2Ids = FnaWorkflowUtil.getActionSet4MulWf(_workflowid, "mulFrozeNode2Ids"); String frozeNode3Ids = FnaWorkflowUtil.getActionSet4MulWf(_workflowid, "mulFrozeNode3Ids"); String deductNode1Ids = FnaWorkflowUtil.getActionSet4MulWf(_workflowid, "mulDeductNode1Ids"); String deductNode2Ids = FnaWorkflowUtil.getActionSet4MulWf(_workflowid, "mulDeductNode2Ids"); String deductNode3Ids = FnaWorkflowUtil.getActionSet4MulWf(_workflowid, "mulDeductNode3Ids"); boolean hasFroze = (!"".equals(frozeNode1Ids) || !"".equals(frozeNode2Ids) || !"".equals(frozeNode3Ids)); boolean hasDeduct = (!"".equals(deductNode1Ids) || !"".equals(deductNode2Ids) || !"".equals(deductNode3Ids)); if (hasFroze || hasDeduct) { FnaFreezeBudget fnaFreezeBudget = new FnaFreezeBudget(); if (hasDeduct) { fnaFreezeBudget.setDeductAction(Boolean.TRUE); } RequestService requestService = new RequestService(); RequestInfo requestInfo = requestService.getRequest(requestid); requestInfo.getRequestManager().setWorkflowid(_workflowid); requestInfo.getRequestManager().setFormid(formid); requestInfo.getRequestManager().setSrc("submit"); User user = new User(1); user.setLanguage(7); requestInfo.getRequestManager().setUser(user); fnaFreezeBudget.execute(requestInfo); } } catch (Exception ex1) { } } } } /** * 获得有权限查看的流程的过滤条件的sql * * @param user * @param tableAliasNameForRequestId * @param tableAliasNameForWorkflowId * @return */ public static String getCanQueryRequestSqlCondition(User user, String tableAliasNameForRequestId, String tableAliasNameForWorkflowId) { int userID = user.getUID(); String usertype = "0"; if (user.getLogintype().equals("2")) { usertype = "1"; } return getCanQueryRequestSqlCondition(userID, usertype, tableAliasNameForRequestId, tableAliasNameForWorkflowId); } /** * 获得有权限查看的流程的过滤条件的sql * * @param userID * @param usertype * @param tableAliasNameForRequestId * @param tableAliasNameForWorkflowId * @return */ public static String getCanQueryRequestSqlCondition(int userID, String usertype, String tableAliasNameForRequestId, String tableAliasNameForWorkflowId) { StringBuffer sqlwhere = new StringBuffer(); sqlwhere.append(" and exists (select 1 from workflow_currentoperator b,workflow_base c where b.requestid = " + tableAliasNameForRequestId + ".requestid "); sqlwhere.append(" and b.userid in (" + userID); sqlwhere.append(" )and b.usertype=" + usertype + " and " + tableAliasNameForWorkflowId + ".workflowid = c.id" + " and c.isvalid in (1,3) and (c.istemplate is null or c.istemplate<>'1'))"); sqlwhere.append(" "); return sqlwhere.toString(); } /** * 获取生成选择借款流程借款明细的按钮 * * @param jklc 无用 * @param spanValue 默认显示内容 * @param fieldid 字段id * @param derecorderindex 明细行行号 * @param finCss 显示内容css样式 * @param ismand 是否可编辑:1是;其他否; * @return */ public static String getBtnRequestDtlBrowser(int jklc, String spanValue, int fieldid, String derecorderindex, String finCss, int ismand) { if (ismand == 1 && Util.getIntValue(spanValue) <= 0) { spanValue = ""; } String spanStr = "" + spanValue + ""; String inputStr = spanStr + "
" + "" + "" + "" + "" + "" + "
"; return inputStr; } /** * 获取生成选择预付款流程预付款明细的按钮 * * @param jklc 无用 * @param spanValue 默认显示内容 * @param fieldid 字段id * @param derecorderindex 明细行行号 * @param finCss 显示内容css样式 * @param ismand 是否可编辑:1是;其他否; * @return */ public static String getBtnAdvanceRequestDtlBrowser(int jklc, String spanValue, int fieldid, String derecorderindex, String finCss, int ismand) { if (ismand == 1 && Util.getIntValue(spanValue) <= 0) { spanValue = ""; } String spanStr = "" + spanValue + ""; String inputStr = spanStr + "
" + "" + "" + "" + "" + "" + "
"; return inputStr; } /** * 获取生成查看借还款金额修改历史的按钮 * * @param fieldid 字段id * @param derecorderindex 明细行行号 * @param languageId 当前登录用户所用语言标识 * @param detailRecordId 字段所在明细表序号 * @return */ public static String getBtnTzmx(int fieldid, String derecorderindex, int languageId, int detailRecordId) { String inputStr = ""; return inputStr; } /** * 获取生成查看预付款金额修改历史的按钮 * * @param fieldid 字段id * @param derecorderindex 明细行行号 * @param languageId 当前登录用户所用语言标识 * @param detailRecordId 字段所在明细表序号 * @return */ public static String getBtnTzmxAdvance(int fieldid, String derecorderindex, int languageId, int detailRecordId) { String inputStr = ""; return inputStr; } /** * 获取生成查询相关还款流程的按钮 * * @param fieldid 字段id * @param derecorderindex 明细行行号 * @param languageId 当前登录用户所用语言标识 * @param detailRecordId 字段所在明细表序号 * @return */ public static String getBtnXghklc(int fieldid, String derecorderindex, int languageId, int detailRecordId) { String inputStr = ""; return inputStr; } /** * 检查指定流程指定字段是否是指定类型的预算类流程字段 * * @param workflowid 流程wfid * @param fieldId 字段id * @param fieldType 字段类型 * @param dtlNumber 明细表序号 * @param fnaWfType 预算类流程类型 * @return */ public static boolean checkFnaWfFieldFnaType(int workflowid, int fieldId, int fieldType, int dtlNumber, String fnaWfType) { RecordSet rs_fna = new RecordSet(); String sql = "select count(*) cnt from fnaFeeWfInfoField a join fnaFeeWfInfo b on b.id = a.MAINID \n" + " where a.DTLNUMBER = " + dtlNumber + " and a.fieldType = " + fieldType + " and a.fieldId = " + fieldId + " " + " and b.FNAWFTYPE = '" + StringEscapeUtils.escapeSql(fnaWfType) + "' and a.workflowid = " + workflowid; rs_fna.executeSql(sql); if (rs_fna.next() && rs_fna.getInt("cnt") > 0) { return true; } return false; } /** * 获取相关还款流程配置信息 * * @param _workflowid * @return 是否是借款费控流程:key:isEnableFnaRepaymentWf;value:true、false;
* 流程表单id:key:formId;value:表单id;
* 流程是否新表单:key:isbill;value:0、1; */ public static HashMap getIsEnableFnaRepaymentWfHm(int _workflowid) { BaseBean _bb = new BaseBean(); RecordSet rs_fna = new RecordSet(); HashMap retHm = new HashMap(); //是否是系统表单的费控流程 int _formId = 0; int _isbill = -1; String sqlFna1 = "select a.formid, a.isbill from workflow_base a where a.id = " + _workflowid; rs_fna.executeSql(sqlFna1); if (rs_fna.next()) { _formId = Util.getIntValue(rs_fna.getString("formid"), 0); _isbill = Util.getIntValue(rs_fna.getString("isbill"), 0); } retHm.put("formId", _formId + ""); retHm.put("isbill", _isbill + ""); //是否是启用的Ecology8还款费控流程 retHm.put("isEnableFnaRepaymentWf", "false"); String sqlFnaWfSet = "select a.enable from fnaFeeWfInfo a where a.fnaWfType = 'repayment' and a.workflowid = " + _workflowid; rs_fna.executeSql(sqlFnaWfSet); if (rs_fna.next()) { if (rs_fna.getInt("enable") == 1) { retHm.put("isEnableFnaRepaymentWf", "true"); } } return retHm; } /** * 获取相关借款流程配置信息 * * @param _workflowid * @return 是否是借款费控流程:key:isEnableFnaBorrowWf;value:true、false;
* 流程表单id:key:formId;value:表单id;
* 流程是否新表单:key:isbill;value:0、1; */ public static HashMap getIsEnableFnaBorrowWfHm(int _workflowid) { BaseBean _bb = new BaseBean(); RecordSet rs_fna = new RecordSet(); HashMap retHm = new HashMap(); //是否是系统表单的费控流程 int _formId = 0; int _isbill = -1; String sqlFna1 = "select a.formid, a.isbill from workflow_base a where a.id = " + _workflowid; rs_fna.executeSql(sqlFna1); if (rs_fna.next()) { _formId = Util.getIntValue(rs_fna.getString("formid"), 0); _isbill = Util.getIntValue(rs_fna.getString("isbill"), 0); } retHm.put("formId", _formId + ""); retHm.put("isbill", _isbill + ""); //是否是启用的Ecology8借款费控流程 retHm.put("isEnableFnaBorrowWf", "false"); String sqlFnaWfSet = "select a.enable from fnaFeeWfInfo a where a.fnaWfType = 'borrow' and a.workflowid = " + _workflowid; rs_fna.executeSql(sqlFnaWfSet); if (rs_fna.next()) { if (rs_fna.getInt("enable") == 1) { retHm.put("isEnableFnaBorrowWf", "true"); } } return retHm; } /** * 拆封in中的值的长度,防止超过999调后sql执行报错 * * @param condStr 完整的值 * @param splitNumber 拆分长度 * @param chr1 ,号 * @param df 如果值是字符串则传入null * @return */ public static List splitToListForSqlCond(String condStr, int splitNumber, String chr1, DecimalFormat df) { List condList = new ArrayList(); String[] _reqIdArray = condStr.split(","); int _reqIdArrayLen = _reqIdArray.length; int _reqIdArrayIndex = 0; while (_reqIdArrayIndex < _reqIdArrayLen) { StringBuffer _reqIdArrayCond = new StringBuffer(""); for (int i = 0; i < splitNumber; i++) { if (_reqIdArrayIndex == _reqIdArrayLen) { break; } if (_reqIdArrayCond.length() > 0) { _reqIdArrayCond.append(chr1); } String _key = _reqIdArray[_reqIdArrayIndex]; if (df == null) { _reqIdArrayCond.append("'" + StringEscapeUtils.escapeSql(_key) + "'"); } else { _reqIdArrayCond.append(df.format(Util.getDoubleValue(_key, 0))); } _reqIdArrayIndex++; } condList.add(_reqIdArrayCond.toString()); } return condList; } /** * 获取报销单位浏览按钮类型,依据报销类型 * * @param fieldid 字段id * @param oldBtnType 转义前对应的承担主体流程表单字段的字段的浏览按钮类型 * @param detailRecordId 明细表数据库记录id值 * @param requestId 流程reqid * @param fnaWfSetMap 预算流程字段对应关系hm对象 * @param reqDataMap 流程数据hm对象 * @param languageId 当前登录人员语言标识 * @param otherPara_hs 调用该函数的流程方法内有一个同名变量 * @param otherReturnVal 返回值hm对象 * @return 转义后对应的承担主体流程表单字段的字段的浏览按钮类型 */ public static int getOrgBtnTypeByFnaFieldType(int fieldid, int oldBtnType, int detailRecordId, int requestId, Map fnaWfSetMap, HashMap> reqDataMap, int languageId, Hashtable otherPara_hs, HashMap otherReturnVal) { return FnaCommon.getOrgBtnTypeByFnaFieldType(fieldid, oldBtnType, detailRecordId + "", requestId, fnaWfSetMap, reqDataMap, languageId, otherPara_hs, otherReturnVal); } /** * 依据承担主体类型获取承担主体名称 * * @param oldOrgName 转义前的承担主体名称 * @param _detailFieldId 字段id * @param requestid 流程reqid * @param rowIdx 明细行行号 * @param fnaWfType 财务类流程类型标识 * @param fnaWfSetMap 预算流程字段对应关系hm对象 * @param reqDataMap 流程数据hm对象 * @param otherPara_hs 调用该函数的流程方法内有一个同名变量 * @param language 当前登录人员语言标识 * @param rci 人员缓存类对象 * @param dci 部门缓存类对象 * @param scci 分部缓存类对象 * @param fccListHm 成本中心缓存对象 * @return 转义后的承担主体名称 */ public static String getOrgNameByOrgType(String oldOrgName, int _detailFieldId, int requestid, int rowIdx, String fnaWfType, HashMap fnaWfSetMap, HashMap> reqDataMap, Hashtable otherPara_hs, int language, ResourceComInfo rci, DepartmentComInfo dci, SubCompanyComInfo scci, HashMap> fccListHm) { if ("fnaFeeWf".equals(fnaWfType) || "change".equals(fnaWfType) || "share".equals(fnaWfType)) {//报销流程;预算变更;费用分摊; if ("fieldIdOrgId_fieldId".equals(fnaWfSetMap.get(_detailFieldId + "")) || "fieldIdOrgId2_fieldId".equals(fnaWfSetMap.get(_detailFieldId + ""))) { FnaSystemSetComInfo fnaSystemSetComInfo = new FnaSystemSetComInfo(); int wfDtlImpRole4Fcc = Util.getIntValue(fnaSystemSetComInfo.get_wfDtlImpRole4Fcc(), 0);//成本中心字段流程明细导入规则 int oldBtnType = Util.getIntValue(fnaWfSetMap.get("fieldIdOrgId_type")); String detailRecordKey = "key_idx>>" + rowIdx; HashMap otherReturnVal = new HashMap(); int newBtnType = FnaCommon.getOrgBtnTypeByFnaFieldType(_detailFieldId, oldBtnType, detailRecordKey, requestid, fnaWfSetMap, reqDataMap, language, otherPara_hs, otherReturnVal); HashMap reqOneRowDataMap = reqDataMap.get(detailRecordKey); int _organizationid_value = 0; if (reqOneRowDataMap != null) { if ("fieldIdOrgId_fieldId".equals(fnaWfSetMap.get(_detailFieldId + ""))) { _organizationid_value = Util.getIntValue(reqOneRowDataMap.get("organizationid"), -1); } else if ("fieldIdOrgId2_fieldId".equals(fnaWfSetMap.get(_detailFieldId + ""))) { _organizationid_value = Util.getIntValue(reqOneRowDataMap.get("organizationid2"), -1); } } if (newBtnType != oldBtnType && _organizationid_value > 0) { String newOrgName = oldOrgName; if (newBtnType == 1) {//个人 newOrgName = Util.null2String(rci.getLastname(_organizationid_value + "")); } else if (newBtnType == 4) {//部门 newOrgName = Util.null2String(dci.getDepartmentname(_organizationid_value + "")); } else if (newBtnType == 164) {//分部 newOrgName = Util.null2String(scci.getSubCompanyname(_organizationid_value + "")); } else if (newBtnType == 251) {//成本中心 HashMap fccHm = fccListHm.get(_organizationid_value + ""); if (fccHm != null) { if (wfDtlImpRole4Fcc == 1) { newOrgName = Util.null2String(fccHm.get("code")).trim(); } else if (wfDtlImpRole4Fcc == 2) { //成本中心全路径名称 newOrgName = RequestDetailImportUtil.getCostCenterFullName(_organizationid_value + ""); } else { newOrgName = Util.null2String(fccHm.get("name")).trim(); } } else { newOrgName = ""; } } oldOrgName = newOrgName; } } } return oldOrgName; } /** * 依据流程选择框的名称,获取选择框的值,并依据选择框的值,返回对应的承担主体浏览按钮的类型 * * @param oldBtnType 转义前对应的承担主体流程表单字段的字段的浏览按钮类型 * @param orgIdFieldId 承担主体浏览按钮的fieldid * @param orgTypeFieldId 承担主体类型按钮的fieldid * @param orgTypeSelectName 承担主体类型选择框选择的名称 * @param requestid 流程reqid * @param language 当前登录人员语言标识 * @param fnaWfSetMap 预算流程字段对应关系hm对象 * @param reqDataMap 流程数据hm对象 * @param otherPara_hs 调用该函数的流程方法内有一个同名变量 * @return 转义后对应的承担主体流程表单字段的字段的浏览按钮类型 */ public static int getOrgSelectValueByOrgTypeSelectName(int oldBtnType, int orgIdFieldId, int orgTypeFieldId, String orgTypeSelectName, int requestid, int language, HashMap fnaWfSetMap, HashMap> reqDataMap, Hashtable otherPara_hs) { RecordSet rs_fna = new RecordSet(); String languageIdStr = ""; if (language > 9) { languageIdStr = language + ""; } else { languageIdStr = language + " "; } int newBtnType = oldBtnType; int selectvalue = -1; String _sql = "select a.selectvalue \n" + " from workflow_SelectItem a \n" + " where 1=1 and (a.cancel is null or a.cancel = 0) " + " and (a.selectname like '%`~`" + languageIdStr + StringEscapeUtils.escapeSql(orgTypeSelectName) + "`~`%' or a.selectname = '" + StringEscapeUtils.escapeSql(orgTypeSelectName) + "') \n" + " and a.fieldid = " + orgTypeFieldId + " order by a.listorder asc"; rs_fna.executeSql(_sql); if (rs_fna.next()) { selectvalue = rs_fna.getInt("selectvalue"); } if (selectvalue == 0) { newBtnType = 1; } else if (selectvalue == 1) { newBtnType = 4; } else if (selectvalue == 2) { newBtnType = 164; } else if (selectvalue == 3) { newBtnType = 251; } else { int detailRecordId = 0; HashMap otherReturnVal = new HashMap(); newBtnType = FnaCommon.getOrgBtnTypeByFnaFieldType(orgIdFieldId, oldBtnType, detailRecordId, requestid, fnaWfSetMap, reqDataMap, language, otherPara_hs, otherReturnVal); } return newBtnType; } /** * 获取报销单位浏览按钮类型,依据报销类型 * * @param fieldid * @param oldBtnType * @param detailRecordKey * @param requestId * @param fnaWfSetMap * @param reqDataMap * @param languageId * @param otherPara_hs * @param otherReturnVal * @return */ public static int getOrgBtnTypeByFnaFieldType(int fieldid, int oldBtnType, String detailRecordKey, int requestId, Map fnaWfSetMap, HashMap> reqDataMap, int languageId, Hashtable otherPara_hs, HashMap otherReturnVal) { BaseBean _bb = new BaseBean(); RecordSet rs_fna = new RecordSet(); detailRecordKey = Util.null2String(detailRecordKey).trim(); // _bb.writeLog("getOrgBtnTypeByFnaFieldType"); WFLayoutToHtml wfLayoutToHtml = new WFLayoutToHtml(); int fieldid_tmp = Util.getIntValue((String) otherPara_hs.get("fieldid_tmp")); int fieldhtmltype_tmp = Util.getIntValue((String) otherPara_hs.get("fieldhtmltype_tmp")); int type_tmp = Util.getIntValue((String) otherPara_hs.get("type_tmp")); Hashtable inoperatefield_hs = (Hashtable) otherPara_hs.get("inoperatefield_hs"); if (inoperatefield_hs == null) { inoperatefield_hs = new Hashtable(); } Hashtable fieldvalue_hs = (Hashtable) otherPara_hs.get("fieldvalue_hs"); if (fieldvalue_hs == null) { fieldvalue_hs = new Hashtable(); } Map fieldMap = (Map) otherPara_hs.get("fieldMap"); if (fieldMap == null) { fieldMap = new HashMap(); } ResourceComInfo resourceComInfo = (ResourceComInfo) otherPara_hs.get("resourceComInfo"); if (resourceComInfo == null) { try { resourceComInfo = new ResourceComInfo(); } catch (Exception e) { _bb.writeLog(e); } } String prjid = Util.null2String((String) otherPara_hs.get("prjid")).trim(); String docid = Util.null2String((String) otherPara_hs.get("docid")).trim(); String dt_beagenter = Util.null2String((String) otherPara_hs.get("dt_beagenter")).trim(); String hrmid = Util.null2String((String) otherPara_hs.get("hrmid")).trim(); int body_isagent = Util.getIntValue((String) otherPara_hs.get("body_isagent")); int agenttype = Util.getIntValue((String) otherPara_hs.get("agenttype")); String crmid = Util.null2String((String) otherPara_hs.get("crmid")).trim(); String reqid = Util.null2String((String) otherPara_hs.get("reqid")).trim(); int organizationtype = -1; boolean _isDbDataFlag = false; HashMap reqOneRowDataMap = null; // new BaseBean().writeLog("reqDataMap="+reqDataMap+";requestId="+requestId+";"); if (reqDataMap != null && requestId > 0) { String fieldIdSubject_isDtl = Util.null2String(fnaWfSetMap.get("fieldIdSubject_fieldId_isDtl")); String fieldIdOrgType_isDtl = Util.null2String(fnaWfSetMap.get("fieldIdOrgType_fieldId_isDtl")); String fieldIdOrgId_isDtl = Util.null2String(fnaWfSetMap.get("fieldIdOrgId_fieldId_isDtl")); String fieldIdOccurdate_isDtl = Util.null2String(fnaWfSetMap.get("fieldIdOccurdate_fieldId_isDtl")); //报销明细中是否包含了明细表字段 boolean dt1_haveIsDtlField = ("1".equals(fieldIdSubject_isDtl) || "1".equals(fieldIdOrgType_isDtl) || "1".equals(fieldIdOrgId_isDtl) || "1".equals(fieldIdOccurdate_isDtl)); // new BaseBean().writeLog("fieldIdSubject_isDtl="+fieldIdSubject_isDtl+";"); // new BaseBean().writeLog("fieldIdOrgType_isDtl="+fieldIdOrgType_isDtl+";"); // new BaseBean().writeLog("***************fieldIdOrgId_isDtl="+fieldIdOrgId_isDtl+";"); // new BaseBean().writeLog("fieldIdOccurdate_isDtl="+fieldIdOccurdate_isDtl+";"); // new BaseBean().writeLog("***************dt1_haveIsDtlField="+dt1_haveIsDtlField+";"); if (!"1".equals(fieldIdOrgId_isDtl) && dt1_haveIsDtlField) {//承担主体是主表,但是,有其他字段是明细表时,随便取reqDataMap中的一个值中即可 // new BaseBean().writeLog("reqDataMap="+reqDataMap+";"); Iterator iter = reqDataMap.entrySet().iterator(); // new BaseBean().writeLog("iter="+iter+";"); if (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); // new BaseBean().writeLog("entry="+entry+";"); reqOneRowDataMap = (HashMap) entry.getValue(); // new BaseBean().writeLog("1 reqOneRowDataMap="+reqOneRowDataMap+";"); } } else if ((!"".equals(detailRecordKey) && detailRecordKey.startsWith("key_idx>>")) || Util.getIntValue(detailRecordKey) > 0) {//先检查是否是来自明细,如果是来自明细则使用明细id获取数据 reqOneRowDataMap = reqDataMap.get(detailRecordKey + ""); } else if (requestId > 0) {//如果不是来自明细则使用主表requestid来获取数据 reqOneRowDataMap = reqDataMap.get(requestId + ""); } } // new BaseBean().writeLog("f reqOneRowDataMap="+reqOneRowDataMap+";"); if (reqOneRowDataMap == null) {//数据库里面没有记录 // fnaWfSetMap // requestId // detailRecordKey String formid = Util.null2String(fnaWfSetMap.get("formid")); int formidABS = Math.abs(Util.getIntValue(formid, 0)); if (formidABS > 0) { String fieldIdOrgType_fieldName = ""; String fieldIdOrgType_fieldId_isDtl = ""; if ("fieldIdOrgId_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { fieldIdOrgType_fieldName = Util.null2String(fnaWfSetMap.get("fieldIdOrgType_fieldName")).trim(); fieldIdOrgType_fieldId_isDtl = Util.null2String(fnaWfSetMap.get("fieldIdOrgType_fieldId_isDtl")).trim(); } else if ("fieldIdOrgId2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { fieldIdOrgType_fieldName = Util.null2String(fnaWfSetMap.get("fieldIdOrgType2_fieldName")).trim(); fieldIdOrgType_fieldId_isDtl = Util.null2String(fnaWfSetMap.get("fieldIdOrgType2_fieldId_isDtl")).trim(); } if (!"".equals(fieldIdOrgType_fieldName)) { StringBuffer sqlQry = new StringBuffer(); sqlQry.append("select t.").append(fieldIdOrgType_fieldName).append(" orgType "); sqlQry.append(" from "); if (!"1".equals(fieldIdOrgType_fieldId_isDtl)) { sqlQry.append(" formtable_main_").append(formidABS).append(" t "); } else { sqlQry.append(" formtable_main_").append(formidABS).append(" main "); sqlQry.append(" join ").append("formtable_main_").append(formidABS).append("_dt1 t on main.id = t.mainid "); } sqlQry.append(" where 1=1 "); if (!"1".equals(fieldIdOrgType_fieldId_isDtl)) { } else { sqlQry.append(" and t.id=? "); } sqlQry.append(" and "); if (!"1".equals(fieldIdOrgType_fieldId_isDtl)) { sqlQry.append("t."); } else { sqlQry.append("main."); } sqlQry.append("requestid=? "); RecordSet rs_sqlQry = new RecordSet(); if (!"1".equals(fieldIdOrgType_fieldId_isDtl)) { rs_sqlQry.executeQuery(sqlQry.toString(), requestId); } else { rs_sqlQry.executeQuery(sqlQry.toString(), detailRecordKey, requestId); } if (rs_sqlQry.next()) { String _orgTypeValue = Util.null2String(rs_sqlQry.getString("orgType")).trim(); reqOneRowDataMap = new HashMap(); if ("fieldIdOrgId_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { reqOneRowDataMap.put("organizationtype", _orgTypeValue); } else if ("fieldIdOrgId2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { reqOneRowDataMap.put("organizationtype2", _orgTypeValue); } } } } } // new BaseBean().writeLog("f1 reqOneRowDataMap="+reqOneRowDataMap+";"); if (reqOneRowDataMap != null) {//数据库里面有记录,表示是历史行 organizationtype = -1; if ("fieldIdOrgId_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { organizationtype = Util.getIntValue(reqOneRowDataMap.get("organizationtype"), -1); } else if ("fieldIdOrgId2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { organizationtype = Util.getIntValue(reqOneRowDataMap.get("organizationtype2"), -1); } _isDbDataFlag = true; // _bb.writeLog("1 organizationtype="+organizationtype); } else {//数据库中无纪律,表示是新增行 int ortType_fieldid_tmp = 0; int ortType_fieldhtmltype_tmp = 0; int ortType_type_tmp = 0; if ("fieldIdOrgId_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { ortType_fieldid_tmp = Util.getIntValue(fnaWfSetMap.get("fieldIdOrgType_fieldId")); ortType_fieldhtmltype_tmp = Util.getIntValue(fnaWfSetMap.get("fieldIdOrgType_fieldhtmltype")); ortType_type_tmp = Util.getIntValue(fnaWfSetMap.get("fieldIdOrgType_type")); } else if ("fieldIdOrgId2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { ortType_fieldid_tmp = Util.getIntValue(fnaWfSetMap.get("fieldIdOrgType2_fieldId")); ortType_fieldhtmltype_tmp = Util.getIntValue(fnaWfSetMap.get("fieldIdOrgType2_fieldhtmltype")); ortType_type_tmp = Util.getIntValue(fnaWfSetMap.get("fieldIdOrgType2_type")); } // _bb.writeLog("ortType_fieldid_tmp="+ortType_fieldid_tmp+";ortType_fieldhtmltype_tmp="+ortType_fieldhtmltype_tmp+";ortType_type_tmp="+ortType_type_tmp); String fieldvalue_tmp = wfLayoutToHtml.getFieldValueTmp(ortType_fieldid_tmp, ortType_fieldhtmltype_tmp, ortType_type_tmp, inoperatefield_hs, fieldvalue_hs, fieldMap, resourceComInfo, prjid, docid, dt_beagenter, hrmid, body_isagent, agenttype, crmid, reqid); organizationtype = Util.getIntValue(fieldvalue_tmp); if (organizationtype < 0) { if ("fieldIdOrgId_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { organizationtype = Util.getIntValue(fnaWfSetMap.get("fieldIdOrgType_defaultSelectValue")); ; } else if ("fieldIdOrgId2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { organizationtype = Util.getIntValue(fnaWfSetMap.get("fieldIdOrgType2_defaultSelectValue")); } } // _bb.writeLog("2 organizationtype="+organizationtype+";fieldvalue_tmp="+fieldvalue_tmp); } if ("fieldIdOrgId_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdOrgId2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { int btnType = oldBtnType; if (organizationtype == 0) {//个人 btnType = 1; } else if (organizationtype == 1) {//部门 btnType = 4; } else if (organizationtype == 2) {//分部 btnType = 164; } else if (organizationtype == 3) {//成本中心 btnType = 251; } // _bb.writeLog("btnType="+btnType+";_oldBtnType="+oldBtnType); String fieldvalue_tmp = ""; if (!_isDbDataFlag && btnType != oldBtnType) { fieldvalue_tmp = wfLayoutToHtml.getFieldValueTmp(fieldid, 3, btnType, inoperatefield_hs, fieldvalue_hs, fieldMap, resourceComInfo, prjid, docid, dt_beagenter, hrmid, body_isagent, agenttype, crmid, reqid); if (Util.getIntValue(fieldvalue_tmp) == 0) { fieldvalue_tmp = ""; } otherReturnVal.put("newOrgIdDefValue", fieldvalue_tmp); // _bb.writeLog("newOrgIdDefValue="+fieldvalue_tmp); } if (!_isDbDataFlag && btnType == 251 && "".equals(fieldvalue_tmp)) {//成本中心 String fieldIdOrgId_automaticTake = Util.null2String(fnaWfSetMap.get("fieldIdOrgId_automaticTake")); if ("1".equals(fieldIdOrgId_automaticTake)) { String _fnaFccId_fieldvalue_tmp_key = "fieldIdOrgId_automaticTake_hrmid=" + hrmid + "_isDbDataFlagEqualsFalse_btnType251_fnaFccId_fieldvalue_tmp_key"; if (otherPara_hs.containsKey(_fnaFccId_fieldvalue_tmp_key)) { fieldvalue_tmp = Util.null2String((String) otherPara_hs.get(_fnaFccId_fieldvalue_tmp_key)).trim(); } else { HashMap dataMapHrm = new HashMap(); FnaCommon.getHrmResourceInfo(dataMapHrm, Util.getIntValue(hrmid)); String _fnaFccId = Util.null2String(dataMapHrm.get("fccId")); fieldvalue_tmp = _fnaFccId; if (Util.getIntValue(fieldvalue_tmp) == 0) { fieldvalue_tmp = ""; } otherPara_hs.put(_fnaFccId_fieldvalue_tmp_key, fieldvalue_tmp); } otherReturnVal.put("newOrgIdDefValue", fieldvalue_tmp); } } // _bb.writeLog("btnType="+btnType); return btnType; } // _bb.writeLog("_oldBtnType="+oldBtnType); return oldBtnType; } /** * 获取预算信息字段显示内容 * * @param fieldid * @param detailRecordId * @param fieldvalue_old * @param _requestId * @param _detailNumber * @param fnaWfSetMap * @param reqDataMap * @param fnaExpenseInfoAllRowRecordHm * @param languageId * @param otherPara_hs * @return */ public String getRemainByFnaFieldType(int fieldid, int detailRecordId, String fieldvalue_old, int _requestId, int _detailNumber, Map fnaWfSetMap, HashMap> reqDataMap, HashMap> fnaExpenseInfoAllRowRecordHm, int languageId, Hashtable otherPara_hs) { if (_requestId > 0) { RecordSet rs2 = new RecordSet(); //启用多明细表报销 int fnaWfTypeMultiReim = 0; rs2.executeQuery("select a.* from fnaFeeWfInfo a join workflow_requestbase b on a.workflowid = b.workflowid where b.requestid = " + _requestId); if (rs2.next()) { fnaWfTypeMultiReim = rs2.getInt("fnaWfTypeMultiReim"); } //启用多明细表报销,开关开启:当前流程的任意明细表都 【 可以用于也仅可以用于 】 费用报销;不再支持"还款,预付款冲销"功能; if (fnaWfTypeMultiReim == 1) { return ""; } } BaseBean _bb = new BaseBean(); //_bb.writeLog("getRemainByFnaFieldType"); String _hrmremain_fieldName = Util.null2String(fnaWfSetMap.get("fieldIdHrmInfo_fieldName")).trim(); String _deptremain_fieldName = Util.null2String(fnaWfSetMap.get("fieldIdDepInfo_fieldName")).trim(); String _subcomremain_fieldName = Util.null2String(fnaWfSetMap.get("fieldIdSubInfo_fieldName")).trim(); String _Fcc_fieldName = Util.null2String(fnaWfSetMap.get("fieldIdFccInfo_fieldName")).trim(); String _hrmremain_fieldName2 = Util.null2String(fnaWfSetMap.get("fieldIdHrmInfo2_fieldName")).trim(); String _deptremain_fieldName2 = Util.null2String(fnaWfSetMap.get("fieldIdDepInfo2_fieldName")).trim(); String _subcomremain_fieldName2 = Util.null2String(fnaWfSetMap.get("fieldIdSubInfo2_fieldName")).trim(); String _Fcc_fieldName2 = Util.null2String(fnaWfSetMap.get("fieldIdFccInfo2_fieldName")).trim(); int subject = -1; int organizationtype = -1; int organizationid = -1; String budgetperiod = ""; String _fnaWfFieldFnaType_typeFlag = ""; String[] _dt1_remain_array = new String[]{"", "", "", ""}; HashMap reqOneRowDataMap = null; if (reqDataMap != null) { if (detailRecordId > 0) {//先检查是否是来自明细,如果是来自明细则使用明细id获取数据 reqOneRowDataMap = reqDataMap.get(detailRecordId + ""); } else if (_requestId > 0) {//如果不是来自明细则使用主表requestid来获取数据 reqOneRowDataMap = reqDataMap.get(_requestId + ""); } } if ("fieldIdHrmInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdDepInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdSubInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdFccInfo_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { if (reqOneRowDataMap != null) { subject = Util.getIntValue(reqOneRowDataMap.get("subject"), -1); organizationtype = Util.getIntValue(reqOneRowDataMap.get("organizationtype"), -1); organizationid = Util.getIntValue(reqOneRowDataMap.get("organizationid"), -1); budgetperiod = Util.null2String(reqOneRowDataMap.get("budgetperiod")).trim(); } _fnaWfFieldFnaType_typeFlag = "6_7_8_9"; _dt1_remain_array = new String[]{_hrmremain_fieldName, _deptremain_fieldName, _subcomremain_fieldName, _Fcc_fieldName}; } else if ("fieldIdHrmInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdDepInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdSubInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdFccInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { if (reqOneRowDataMap != null) { subject = Util.getIntValue(reqOneRowDataMap.get("subject2"), -1); organizationtype = Util.getIntValue(reqOneRowDataMap.get("organizationtype2"), -1); organizationid = Util.getIntValue(reqOneRowDataMap.get("organizationid2"), -1); budgetperiod = Util.null2String(reqOneRowDataMap.get("budgetperiod2")).trim(); } _fnaWfFieldFnaType_typeFlag = "14_15_16_17"; _dt1_remain_array = new String[]{_hrmremain_fieldName2, _deptremain_fieldName2, _subcomremain_fieldName2, _Fcc_fieldName2}; } BudgetHandler budgetHandler = new BudgetHandler(); int orgtype = -1; if (organizationtype == 0) {//个人 orgtype = 3; } else if (organizationtype == 1) {//部门 orgtype = 2; } else if (organizationtype == 2) {//分部 orgtype = 1; } else if (organizationtype == 3) {//成本中心 orgtype = FnaCostCenter.ORGANIZATION_TYPE; } if (organizationtype >= 0 && organizationtype <= 3) { if ("fieldIdHrmInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdDepInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdSubInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdFccInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdHrmInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdDepInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdSubInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdFccInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { String infos = " , , | , , , | , , , | , , , | , , , | , , , | , , , | , , , | , , , "; if (!"".equals(budgetperiod) && orgtype != -1 && organizationid > 0 && subject > 0) { String key01 = "FnaCommon_getRemainByFnaFieldType_" + _fnaWfFieldFnaType_typeFlag + "_requestId=" + _requestId + "detailRecordId=" + detailRecordId + "_detailNumber=" + _detailNumber; if (otherPara_hs.containsKey(key01)) { infos = (String) otherPara_hs.get(key01); } else { HashMap fnaExpenseInfoRecordHm = fnaExpenseInfoAllRowRecordHm.get(detailRecordId + ""); infos = Util.null2String(budgetHandler.getBudgetKPI4DWR(budgetperiod, orgtype, organizationid, subject, true, true, detailRecordId, _requestId, fnaExpenseInfoRecordHm)).trim(); otherPara_hs.put(key01, infos); } } String[] fnainfos = infos.split("\\|"); String budgetAutoMoveInfo = ""; if (fnainfos.length >= 5) { budgetAutoMoveInfo = fnainfos[4]; if (!"".equals(budgetAutoMoveInfo)) { String regex = "^[, ]+$"; Pattern pattern = Pattern.compile(regex); Matcher match = pattern.matcher(budgetAutoMoveInfo); if (match.matches()) {//判断是否只包含了逗号和空格,如果是则不处理 budgetAutoMoveInfo = ""; } else { budgetAutoMoveInfo = SystemEnv.getHtmlLabelName(126630, languageId) + ":" + budgetAutoMoveInfo; } } } String _dt1_remain_only = ""; if (getFnaNotEmptyCount(_dt1_remain_array) == 1) { _dt1_remain_only = getFnaOnlyNotEmptyValue(_dt1_remain_array); } String[] values = new String[]{"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""}; int fnainfosLen = fnainfos.length; if (("fieldIdHrmInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdHrmInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) && fnainfosLen >= 1) { String _dt1_remain = _dt1_remain_array[0]; if ((!_dt1_remain_only.equals("") && _dt1_remain_only.equals(_dt1_remain)) || (getFnaSameValueCount(_dt1_remain_array, _dt1_remain) > 1)) { values = fnainfos[organizationtype].split(","); } else { values = fnainfos[0].split(","); } } else if (("fieldIdDepInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdDepInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) && fnainfosLen >= 2) { String _dt1_remain = _dt1_remain_array[1]; if ((!_dt1_remain_only.equals("") && _dt1_remain_only.equals(_dt1_remain)) || (getFnaSameValueCount(_dt1_remain_array, _dt1_remain) > 1)) { values = fnainfos[organizationtype].split(","); } else { values = fnainfos[1].split(","); } } else if (("fieldIdSubInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdSubInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) && fnainfosLen >= 3) { String _dt1_remain = _dt1_remain_array[2]; if ((!_dt1_remain_only.equals("") && _dt1_remain_only.equals(_dt1_remain)) || (getFnaSameValueCount(_dt1_remain_array, _dt1_remain) > 1)) { values = fnainfos[organizationtype].split(","); } else { values = fnainfos[2].split(","); } } else if (("fieldIdFccInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdFccInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) && fnainfosLen >= 4) { String _dt1_remain = _dt1_remain_array[3]; if ((!_dt1_remain_only.equals("") && _dt1_remain_only.equals(_dt1_remain)) || (getFnaSameValueCount(_dt1_remain_array, _dt1_remain) > 1)) { values = fnainfos[organizationtype].split(","); } else { values = fnainfos[3].split(","); } } String values0 = ""; String values1 = ""; String values2 = ""; int valuesLen = values.length; if (valuesLen >= 1) { values0 = values[0]; } if (valuesLen >= 2) { values1 = values[1]; } if (valuesLen >= 3) { values2 = values[2]; } String tempmsg = SystemEnv.getHtmlLabelName(18768, languageId) + ":" + values0 + "
" + "" + SystemEnv.getHtmlLabelName(18503, languageId) + ":" + values1 + "
" + "" + SystemEnv.getHtmlLabelName(18769, languageId) + ":" + values2 + ""; if (!"".equals(budgetAutoMoveInfo)) { tempmsg += "
" + budgetAutoMoveInfo; } //_bb.writeLog("tempmsg="+tempmsg); return tempmsg; } } return fieldvalue_old; } /** * 获取素组中有相同值的个数 * * @param checkValArray * @param compareValue * @return */ public int getFnaSameValueCount(String[] checkValArray, String compareValue) { int _count = 0; if (checkValArray != null) { for (int i = 0; i < checkValArray.length; i++) { String _val = checkValArray[i]; if (_val.equals(compareValue)) { _count++; } } } return _count; } /** * 获取素组中非相同空项的值(取第一个) * * @param checkValArray * @return */ public String getFnaOnlyNotEmptyValue(String[] checkValArray) { String _value = ""; if (this.getFnaNotEmptyCount(checkValArray) == 1) { if (checkValArray != null) { for (int i = 0; i < checkValArray.length; i++) { String _val = checkValArray[i]; if (_val != null && _val.equals("")) { _value = _val; break; } } } } return _value; } /** * 获取素组中非相同空值数量 * * @param checkValArray * @return */ public int getFnaNotEmptyCount(String[] checkValArray) { int _count = 0; if (checkValArray != null) { for (int i = 0; i < checkValArray.length; i++) { String _val = checkValArray[i]; if (_val != null && _val.equals("")) { _count++; } } } return _count; } /** * 依据流程类型获取查询费控相关字段的sql * * @param _requestId 流程requestid * @param _formId 流程表单id * @param dataMap 预算类流程字段对应关系hm * @param _isEnableFnaWfE8 是否是启用的Ecology8费控流程 * @param _isEnableFnaChangeWf 是否是启用的Ecology8预算变更流程 * @param _isEnableFnaShareWf 是否是启用的Ecology8预算分摊流程 * @return SQL */ public static String getSqlByFnaFieldType(int _requestId, int _formId, Map dataMap, boolean _isEnableFnaWfE8, boolean _isEnableFnaChangeWf, boolean _isEnableFnaShareWf) { // _bb.writeLog("_formId="+_formId+";_isbill="+_isbill+";_isEnableFnaWfE7="+_isEnableFnaWfE7+";_isEnableFnaWfE8="+_isEnableFnaWfE8); StringBuffer sql = new StringBuffer(""); if (_isEnableFnaWfE8 || _isEnableFnaChangeWf || _isEnableFnaShareWf) {//自定义新表单 int _formIdABS = Math.abs(_formId); String fieldIdSubject_isDtl = "1"; String fieldIdOrgType_isDtl = "1"; String fieldIdOrgId_isDtl = "1"; String fieldIdOccurdate_isDtl = "1"; String fieldIdSubject2_isDtl = "1"; String fieldIdOrgType2_isDtl = "1"; String fieldIdOrgId2_isDtl = "1"; String fieldIdOccurdate2_isDtl = "1"; String _subject_fieldName = ""; String _organizationtype_fieldName = ""; String _organizationid_fieldName = ""; String _budgetperiod_fieldName = ""; String _subject_fieldName2 = ""; String _organizationtype_fieldName2 = ""; String _organizationid_fieldName2 = ""; String _budgetperiod_fieldName2 = ""; String fieldIdAmount_isDtl = "1"; String _amount_fieldName = ""; if (_isEnableFnaWfE8) { _subject_fieldName = Util.null2String(dataMap.get("fieldIdSubject_fieldName")); _organizationtype_fieldName = Util.null2String(dataMap.get("fieldIdOrgType_fieldName")); _organizationid_fieldName = Util.null2String(dataMap.get("fieldIdOrgId_fieldName")); _budgetperiod_fieldName = Util.null2String(dataMap.get("fieldIdOccurdate_fieldName")); fieldIdSubject_isDtl = Util.null2String(dataMap.get("fieldIdSubject_fieldId_isDtl")); fieldIdOrgType_isDtl = Util.null2String(dataMap.get("fieldIdOrgType_fieldId_isDtl")); fieldIdOrgId_isDtl = Util.null2String(dataMap.get("fieldIdOrgId_fieldId_isDtl")); fieldIdOccurdate_isDtl = Util.null2String(dataMap.get("fieldIdOccurdate_fieldId_isDtl")); _amount_fieldName = Util.null2String(dataMap.get("fieldIdAmount_fieldName")); fieldIdAmount_isDtl = Util.null2String(dataMap.get("fieldIdAmount_fieldId_isDtl")); } else if (_isEnableFnaChangeWf) { _subject_fieldName = Util.null2String(dataMap.get("fieldIdSubject_fieldName")); _organizationtype_fieldName = Util.null2String(dataMap.get("fieldIdOrgType_fieldName")); _organizationid_fieldName = Util.null2String(dataMap.get("fieldIdOrgId_fieldName")); _budgetperiod_fieldName = Util.null2String(dataMap.get("fieldIdOccurdate_fieldName")); _subject_fieldName2 = Util.null2String(dataMap.get("fieldIdSubject2_fieldName")); _organizationtype_fieldName2 = Util.null2String(dataMap.get("fieldIdOrgType2_fieldName")); _organizationid_fieldName2 = Util.null2String(dataMap.get("fieldIdOrgId2_fieldName")); _budgetperiod_fieldName2 = Util.null2String(dataMap.get("fieldIdOccurdate2_fieldName")); fieldIdSubject_isDtl = Util.null2String(dataMap.get("fieldIdSubject_fieldId_isDtl")); fieldIdOrgType_isDtl = Util.null2String(dataMap.get("fieldIdOrgType_fieldId_isDtl")); fieldIdOrgId_isDtl = Util.null2String(dataMap.get("fieldIdOrgId_fieldId_isDtl")); fieldIdOccurdate_isDtl = Util.null2String(dataMap.get("fieldIdOccurdate_fieldId_isDtl")); fieldIdSubject2_isDtl = Util.null2String(dataMap.get("fieldIdSubject2_fieldId_isDtl")); fieldIdOrgType2_isDtl = Util.null2String(dataMap.get("fieldIdOrgType2_fieldId_isDtl")); fieldIdOrgId2_isDtl = Util.null2String(dataMap.get("fieldIdOrgId2_fieldId_isDtl")); fieldIdOccurdate2_isDtl = Util.null2String(dataMap.get("fieldIdOccurdate2_fieldId_isDtl")); _amount_fieldName = Util.null2String(dataMap.get("fieldIdAmount_fieldName")); fieldIdAmount_isDtl = Util.null2String(dataMap.get("fieldIdAmount_fieldId_isDtl")); } else if (_isEnableFnaShareWf) { _subject_fieldName = Util.null2String(dataMap.get("fieldIdSubject_fieldName")); _organizationtype_fieldName = Util.null2String(dataMap.get("fieldIdOrgType_fieldName")); _organizationid_fieldName = Util.null2String(dataMap.get("fieldIdOrgId_fieldName")); _budgetperiod_fieldName = Util.null2String(dataMap.get("fieldIdOccurdate_fieldName")); _subject_fieldName2 = Util.null2String(dataMap.get("fieldIdSubject2_fieldName")); _organizationtype_fieldName2 = Util.null2String(dataMap.get("fieldIdOrgType2_fieldName")); _organizationid_fieldName2 = Util.null2String(dataMap.get("fieldIdOrgId2_fieldName")); _budgetperiod_fieldName2 = Util.null2String(dataMap.get("fieldIdOccurdate2_fieldName")); fieldIdSubject_isDtl = Util.null2String(dataMap.get("fieldIdSubject_fieldId_isDtl")); fieldIdOrgType_isDtl = Util.null2String(dataMap.get("fieldIdOrgType_fieldId_isDtl")); fieldIdOrgId_isDtl = Util.null2String(dataMap.get("fieldIdOrgId_fieldId_isDtl")); fieldIdOccurdate_isDtl = Util.null2String(dataMap.get("fieldIdOccurdate_fieldId_isDtl")); fieldIdSubject2_isDtl = Util.null2String(dataMap.get("fieldIdSubject2_fieldId_isDtl")); fieldIdOrgType2_isDtl = Util.null2String(dataMap.get("fieldIdOrgType2_fieldId_isDtl")); fieldIdOrgId2_isDtl = Util.null2String(dataMap.get("fieldIdOrgId2_fieldId_isDtl")); fieldIdOccurdate2_isDtl = Util.null2String(dataMap.get("fieldIdOccurdate2_fieldId_isDtl")); _amount_fieldName = Util.null2String(dataMap.get("fieldIdAmount_fieldName")); fieldIdAmount_isDtl = Util.null2String(dataMap.get("fieldIdAmount_fieldId_isDtl")); } if ("".equals(_subject_fieldName2)) { _subject_fieldName2 = _subject_fieldName; fieldIdSubject2_isDtl = fieldIdSubject_isDtl; } if ("".equals(_organizationtype_fieldName2)) { _organizationtype_fieldName2 = _organizationtype_fieldName; fieldIdOrgType2_isDtl = fieldIdOrgType_isDtl; } if ("".equals(_organizationid_fieldName2)) { _organizationid_fieldName2 = _organizationid_fieldName; fieldIdOrgId2_isDtl = fieldIdOrgId_isDtl; } if ("".equals(_budgetperiod_fieldName2)) { _budgetperiod_fieldName2 = _budgetperiod_fieldName; fieldIdOccurdate2_isDtl = fieldIdOccurdate_isDtl; } //报销明细中是否包含了明细表字段 boolean dt1_haveIsDtlField = ("1".equals(fieldIdSubject_isDtl) || "1".equals(fieldIdOrgType_isDtl) || "1".equals(fieldIdOrgId_isDtl) || "1".equals(fieldIdOccurdate_isDtl)); boolean dt1_haveIsDtlField2 = ("1".equals(fieldIdSubject2_isDtl) || "1".equals(fieldIdOrgType2_isDtl) || "1".equals(fieldIdOrgId2_isDtl) || "1".equals(fieldIdOccurdate2_isDtl)); sql.append("select "); if ("1".equals(fieldIdAmount_isDtl)) { sql.append(" b."); } else { sql.append(" a."); } sql.append(_amount_fieldName + " applyamount, \n"); if ("1".equals(fieldIdOrgType_isDtl)) { sql.append(" b."); } else { sql.append(" a."); } sql.append(_organizationtype_fieldName + " organizationtype, \n"); if ("1".equals(fieldIdOrgId_isDtl)) { sql.append(" b."); } else { sql.append(" a."); } sql.append(_organizationid_fieldName + " organizationid, \n"); if ("1".equals(fieldIdSubject_isDtl)) { sql.append(" b."); } else { sql.append(" a."); } sql.append(_subject_fieldName + " subject, \n"); if ("1".equals(fieldIdOccurdate_isDtl)) { sql.append(" b."); } else { sql.append(" a."); } sql.append(_budgetperiod_fieldName + " budgetperiod, \n"); if ("1".equals(fieldIdOrgType2_isDtl)) { sql.append(" b."); } else { sql.append(" a."); } sql.append(_organizationtype_fieldName2 + " organizationtype2, \n"); if ("1".equals(fieldIdOrgId2_isDtl)) { sql.append(" b."); } else { sql.append(" a."); } sql.append(_organizationid_fieldName2 + " organizationid2, \n"); if ("1".equals(fieldIdSubject2_isDtl)) { sql.append(" b."); } else { sql.append(" a."); } sql.append(_subject_fieldName2 + " subject2, \n"); if ("1".equals(fieldIdOccurdate2_isDtl)) { sql.append(" b."); } else { sql.append(" a."); } sql.append(_budgetperiod_fieldName2 + " budgetperiod2, \n"); if (dt1_haveIsDtlField || dt1_haveIsDtlField2) { sql.append(" b.id, b.id dtlId, a.requestid "); } else { sql.append(" a.requestid "); } sql.append(" from formtable_main_" + _formIdABS + " a \n"); if (dt1_haveIsDtlField || dt1_haveIsDtlField2) { sql.append(" join formtable_main_" + _formIdABS + "_dt1 b on a.id = b.mainid \n"); } sql.append(" where a.requestid = " + _requestId); sql.append(" order by "); if (_isEnableFnaChangeWf) { if ("1".equals(fieldIdAmount_isDtl)) { sql.append(" b."); } else { sql.append(" a."); } sql.append(_amount_fieldName + " asc,"); } sql.append(" a.id asc"); if (dt1_haveIsDtlField || dt1_haveIsDtlField2) { sql.append(", b.id asc"); } } return sql.toString(); } /** * 依据getSqlByFnaFieldType方法返回sql,获取当前requestid对应的所有预算相关业务逻辑数据 * * @param _requestId 流程requestid * @param _formId 流程表单id * @param dataMap 预算类流程字段对应关系hm * @param _isEnableFnaWfE8 是否是启用的Ecology8费控流程 * @param _isEnableFnaChangeWf 是否是启用的Ecology8预算变更流程 * @param _isEnableFnaShareWf 是否是启用的Ecology8预算分摊流程 * @return */ public static HashMap> qryFnaExpenseRequestRecord(int _requestId, int _formId, Map dataMap, boolean _isEnableFnaWfE8, boolean _isEnableFnaChangeWf, boolean _isEnableFnaShareWf) { RecordSet rs_fna = new RecordSet(); HashMap> retHm = new HashMap>(); int _idx = 0; String sql = FnaCommon.getSqlByFnaFieldType(_requestId, _formId, dataMap, _isEnableFnaWfE8, _isEnableFnaChangeWf, _isEnableFnaShareWf); if (!"".equals(sql)) { rs_fna.executeSql(sql); while (rs_fna.next()) { HashMap hm = new HashMap(); String keyId = Util.null2String(rs_fna.getString("id")).trim(); if ("".equals(keyId)) { keyId = Util.null2String(rs_fna.getString("requestid")).trim(); } hm.put("organizationtype", Util.null2String(rs_fna.getString("organizationtype")).trim()); hm.put("organizationid", Util.null2String(rs_fna.getString("organizationid")).trim()); hm.put("subject", Util.null2String(rs_fna.getString("subject")).trim()); hm.put("budgetperiod", Util.null2String(rs_fna.getString("budgetperiod")).trim()); hm.put("organizationtype2", Util.null2String(rs_fna.getString("organizationtype2")).trim()); hm.put("organizationid2", Util.null2String(rs_fna.getString("organizationid2")).trim()); hm.put("subject2", Util.null2String(rs_fna.getString("subject2")).trim()); hm.put("budgetperiod2", Util.null2String(rs_fna.getString("budgetperiod2")).trim()); retHm.put(keyId, hm); retHm.put("key_idx>>" + _idx, hm); _idx++; } } return retHm; } /** * 获取指定流程写入费用表的所有数据 * * @param _requestId 流程requestid * @return HashMap> */ public static HashMap> qryFnaExpenseInfoAllRowRecordHm(int _requestId) { RecordSet rs_fna = new RecordSet(); HashMap> retHm = new HashMap>(); //定位 数据库表名, 日期范围可能跨年 List list_out_FnaExpenseInfo = new ArrayList(); FnaSplitTableByYearComInfo.getFnaTableNameList(FnaTableNameEnum.FnaExpenseInfo, "1000-01-01", "9999-12-31", list_out_FnaExpenseInfo); for (int aaaaaaaa = 0; aaaaaaaa < list_out_FnaExpenseInfo.size(); aaaaaaaa++) { String tableName_FnaExpenseInfo = list_out_FnaExpenseInfo.get(aaaaaaaa); String sql = "select a.id, a.organizationid, a.organizationtype, a.occurdate, a.subject, a.amount, a.occurdateOld, \n" + " a.status, a.guid, \n" + " a.requestid, a.requestidDtlId, a.sourceRequestid, a.sourceRequestidDtlId, a.sourceDtlNumber, \n" + " a.budgetperiods, a.budgetperiodslist, a.isBudgetAutoMoveByMinusAmt, a.isBudgetAutoMove \n" + " from " + tableName_FnaExpenseInfo + " a where a.requestid = " + _requestId; rs_fna.executeSql(sql); while (rs_fna.next()) { HashMap hm = new HashMap(); String keyId = Util.null2String(rs_fna.getString("sourceRequestidDtlId")).trim();//这个作为key是唯一的,不需要考虑多张数据表的情况 if (!"".equals(keyId)) { hm.put("id", Util.null2String(rs_fna.getString("id")).trim()); hm.put("organizationid", Util.null2String(rs_fna.getString("organizationid")).trim()); hm.put("organizationtype", Util.null2String(rs_fna.getString("organizationtype")).trim()); hm.put("occurdate", Util.null2String(rs_fna.getString("occurdate")).trim()); hm.put("subject", Util.null2String(rs_fna.getString("subject")).trim()); hm.put("amount", Util.null2String(rs_fna.getString("amount")).trim()); hm.put("occurdateOld", Util.null2String(rs_fna.getString("occurdateOld")).trim()); hm.put("status", Util.null2String(rs_fna.getString("status")).trim()); hm.put("guid", Util.null2String(rs_fna.getString("guid")).trim()); hm.put("requestid", Util.null2String(rs_fna.getString("requestid")).trim()); hm.put("requestidDtlId", Util.null2String(rs_fna.getString("requestidDtlId")).trim()); hm.put("sourceRequestid", Util.null2String(rs_fna.getString("sourceRequestid")).trim()); hm.put("sourceRequestidDtlId", Util.null2String(rs_fna.getString("sourceRequestidDtlId")).trim()); hm.put("sourceDtlNumber", Util.null2String(rs_fna.getString("sourceDtlNumber")).trim()); hm.put("budgetperiods", Util.null2String(rs_fna.getString("budgetperiods")).trim()); hm.put("budgetperiodslist", Util.null2String(rs_fna.getString("budgetperiodslist")).trim()); hm.put("isBudgetAutoMoveByMinusAmt", Util.null2String(rs_fna.getString("isBudgetAutoMoveByMinusAmt")).trim()); hm.put("isBudgetAutoMove", Util.null2String(rs_fna.getString("isBudgetAutoMove")).trim()); retHm.put(keyId, hm); } } }//for end return retHm; } /** * 获取指定流程的冲销/还款数据 * * @param requestid 流程requestid * @param _formId 流程表单id * @param dataMap 预算类流程字段对应关系hm * @return */ public static HashMap> qryFnaRepaymentRequestRecord(int requestid, int _formId, Map dataMap) { RecordSet rs_fna = new RecordSet(); HashMap> retHm = new HashMap>(); String dt2_fieldIdJklc_fieldName = Util.null2String(dataMap.get("dt2_fieldIdJklc_fieldName")); String dt2_fieldIdDnxh_fieldName = Util.null2String(dataMap.get("dt2_fieldIdDnxh_fieldName")); String dt2_fieldIdJkje_fieldName = Util.null2String(dataMap.get("dt2_fieldIdJkje_fieldName")); String dt2_fieldIdYhje_fieldName = Util.null2String(dataMap.get("dt2_fieldIdYhje_fieldName")); String dt2_fieldIdSpzje_fieldName = Util.null2String(dataMap.get("dt2_fieldIdSpzje_fieldName")); String dt2_fieldIdWhje_fieldName = Util.null2String(dataMap.get("dt2_fieldIdWhje_fieldName")); StringBuffer borrowRequestIds = new StringBuffer(); int formidAbs = Math.abs(_formId); HashMap> jklcsHm = new HashMap>(); StringBuffer sql = new StringBuffer(); sql.append("select dt.id dtlId "); if (!"".equals(dt2_fieldIdJklc_fieldName)) { sql.append(", dt." + dt2_fieldIdJklc_fieldName + " jklc "); } if (!"".equals(dt2_fieldIdDnxh_fieldName)) { sql.append(", dt." + dt2_fieldIdDnxh_fieldName + " dnxh "); } if (!"".equals(dt2_fieldIdJkje_fieldName)) { sql.append(", dt." + dt2_fieldIdJkje_fieldName + " jkje "); } if (!"".equals(dt2_fieldIdYhje_fieldName)) { sql.append(", dt." + dt2_fieldIdYhje_fieldName + " yhje "); } if (!"".equals(dt2_fieldIdSpzje_fieldName)) { sql.append(", dt." + dt2_fieldIdSpzje_fieldName + " spzje "); } if (!"".equals(dt2_fieldIdWhje_fieldName)) { sql.append(", dt." + dt2_fieldIdWhje_fieldName + " whje "); } sql.append(" from formtable_main_" + formidAbs + "_dt2 dt "); sql.append(" join formtable_main_" + formidAbs + " main on main.id=dt.mainid "); sql.append(" where main.requestId=" + requestid); rs_fna.executeSql(sql.toString()); while (rs_fna.next()) { HashMap hm = new HashMap(); String keyId = Util.null2String(rs_fna.getString("dtlId")).trim(); String jklc = Util.null2String(rs_fna.getString("jklc")).trim(); String dnxh = Util.null2String(rs_fna.getString("dnxh")).trim(); String jkje = Util.null2String(rs_fna.getString("jkje")).trim(); String yhje = Util.null2String(rs_fna.getString("yhje")).trim(); String spzje = Util.null2String(rs_fna.getString("spzje")).trim(); String whje = Util.null2String(rs_fna.getString("whje")).trim(); String dnxhShowName = ""; int i_jklc = Util.getIntValue(jklc); int i_dnxh = Util.getIntValue(dnxh); if (i_jklc > 0 && i_dnxh > 0) { if (!jklcsHm.containsKey(jklc)) { FnaCommon.getRequestBorrowDnxhShowName(i_jklc, i_dnxh, jklcsHm); } HashMap _jklcDtlIdxHm = jklcsHm.get(jklc); if (_jklcDtlIdxHm != null) { dnxhShowName = Util.null2String(_jklcDtlIdxHm.get(dnxh)).trim(); } } if ("".equals(dnxhShowName)) { dnxhShowName = dnxh; } hm.put("jklc", jklc); hm.put("dnxh", dnxh); hm.put("dnxhShowName", dnxhShowName); hm.put("jkje", jkje); hm.put("yhje", yhje); hm.put("spzje", spzje); hm.put("whje", whje); retHm.put(keyId, hm); if (i_jklc > 0) { if (borrowRequestIds.length() > 0) { borrowRequestIds.append(","); } borrowRequestIds.append(i_jklc); } } if (borrowRequestIds.length() > 0) { String sql1 = "select SUM(CASE WHEN (a.recordType='borrow') THEN a.amountBorrow ELSE 0.0 END) jkje, \n" + " SUM(CASE WHEN (a.recordType='reverse') THEN a.amountBorrow ELSE 0.0 END) yhje, \n" + " SUM(CASE WHEN (a.recordType='freezeBorrow') THEN a.amountBorrow ELSE 0.0 END) spzje, \n" + " SUM(CASE WHEN (a.recordType='borrow') THEN a.amountBorrow ELSE (a.amountBorrow * -1) END) whje, \n" + " a.borrowRequestId, a.borrowRequestIdDtlId \n" + " from FnaBorrowInfo a \n" + " where a.borrowRequestId in (" + borrowRequestIds.toString() + ") \n" + " group by a.borrowRequestId, a.borrowRequestIdDtlId"; rs_fna.executeSql(sql1); while (rs_fna.next()) { HashMap hm = new HashMap(); String keyId = Util.null2String("borrowRequestIdInfo_" + rs_fna.getString("borrowRequestId")).trim() + "_" + Util.null2String(rs_fna.getString("borrowRequestIdDtlId")).trim(); String jkje = Util.null2String(rs_fna.getString("jkje")).trim(); String yhje = Util.null2String(rs_fna.getString("yhje")).trim(); String spzje = Util.null2String(rs_fna.getString("spzje")).trim(); String whje = Util.null2String(rs_fna.getString("whje")).trim(); hm.put("jkje", jkje); hm.put("yhje", yhje); hm.put("spzje", spzje); hm.put("whje", whje); retHm.put(keyId, hm); } } return retHm; } /** * 获取指定流程的预付款相关数据 * * @param requestid 流程requestid * @param _formId 流程表单id * @param dataMap 预算类流程字段对应关系hm * @return */ public static HashMap> qryFnaReverseAdvanceRequestRecord(int requestid, int _formId, Map dataMap) { RecordSet rs_fna = new RecordSet(); HashMap> retHm = new HashMap>(); String dt4_fieldIdYfklc_fieldName = Util.null2String(dataMap.get("dt4_fieldIdYfklc_fieldName")); String dt4_fieldIdDnxh_fieldName = Util.null2String(dataMap.get("dt4_fieldIdDnxh_fieldName")); String dt4_fieldIdYfkje_fieldName = Util.null2String(dataMap.get("dt4_fieldIdYfkje_fieldName")); String dt4_fieldIdYhje_fieldName = Util.null2String(dataMap.get("dt4_fieldIdYhje_fieldName")); String dt4_fieldIdSpzje_fieldName = Util.null2String(dataMap.get("dt4_fieldIdSpzje_fieldName")); String dt4_fieldIdWhje_fieldName = Util.null2String(dataMap.get("dt4_fieldIdWhje_fieldName")); StringBuffer advanceRequestIds = new StringBuffer(); int formidAbs = Math.abs(_formId); HashMap> YfklcsHm = new HashMap>(); StringBuffer sql = new StringBuffer(); sql.append("select dt.id dtlId "); if (!"".equals(dt4_fieldIdYfklc_fieldName)) { sql.append(", dt." + dt4_fieldIdYfklc_fieldName + " Yfklc "); } if (!"".equals(dt4_fieldIdDnxh_fieldName)) { sql.append(", dt." + dt4_fieldIdDnxh_fieldName + " dnxh "); } if (!"".equals(dt4_fieldIdYfkje_fieldName)) { sql.append(", dt." + dt4_fieldIdYfkje_fieldName + " Yfkje "); } if (!"".equals(dt4_fieldIdYhje_fieldName)) { sql.append(", dt." + dt4_fieldIdYhje_fieldName + " yhje "); } if (!"".equals(dt4_fieldIdSpzje_fieldName)) { sql.append(", dt." + dt4_fieldIdSpzje_fieldName + " spzje "); } if (!"".equals(dt4_fieldIdWhje_fieldName)) { sql.append(", dt." + dt4_fieldIdWhje_fieldName + " whje "); } sql.append(" from formtable_main_" + formidAbs + "_dt4 dt "); sql.append(" join formtable_main_" + formidAbs + " main on main.id=dt.mainid "); sql.append(" where main.requestId=" + requestid); rs_fna.executeSql(sql.toString()); while (rs_fna.next()) { HashMap hm = new HashMap(); String keyId = Util.null2String(rs_fna.getString("dtlId")).trim(); String Yfklc = Util.null2String(rs_fna.getString("Yfklc")).trim(); String dnxh = Util.null2String(rs_fna.getString("dnxh")).trim(); String Yfkje = Util.null2String(rs_fna.getString("Yfkje")).trim(); String yhje = Util.null2String(rs_fna.getString("yhje")).trim(); String spzje = Util.null2String(rs_fna.getString("spzje")).trim(); String whje = Util.null2String(rs_fna.getString("whje")).trim(); String dnxhShowName = ""; int i_Yfklc = Util.getIntValue(Yfklc); int i_dnxh = Util.getIntValue(dnxh); if (i_Yfklc > 0 && i_dnxh > 0) { if (!YfklcsHm.containsKey(Yfklc)) { FnaCommon.getRequestAdvanceDnxhShowName(i_Yfklc, i_dnxh, YfklcsHm); } HashMap _YfklcDtlIdxHm = YfklcsHm.get(Yfklc); if (_YfklcDtlIdxHm != null) { dnxhShowName = Util.null2String(_YfklcDtlIdxHm.get(dnxh)).trim(); } } if ("".equals(dnxhShowName)) { dnxhShowName = dnxh; } hm.put("Yfklc", Yfklc); hm.put("dnxh", dnxh); hm.put("dnxhShowName", dnxhShowName); hm.put("Yfkje", Yfkje); hm.put("yhje", yhje); hm.put("spzje", spzje); hm.put("whje", whje); retHm.put(keyId, hm); if (i_Yfklc > 0) { if (advanceRequestIds.length() > 0) { advanceRequestIds.append(","); } advanceRequestIds.append(i_Yfklc); } } if (advanceRequestIds.length() > 0) { String sql1 = "select SUM(CASE WHEN (a.recordType='advance') THEN a.amountAdvance ELSE 0.0 END) Yfkje, \n" + " SUM(CASE WHEN (a.recordType='reverse') THEN a.amountAdvance ELSE 0.0 END) yhje, \n" + " SUM(CASE WHEN (a.recordType='freezeAdvance') THEN a.amountAdvance ELSE 0.0 END) spzje, \n" + " SUM(CASE WHEN (a.recordType='advance') THEN a.amountAdvance ELSE (a.amountAdvance * -1." + ") END) whje, \n" + " a.advanceRequestId, a.advanceRequestIdDtlId \n" + " from FnaAdvanceInfo a \n" + " where a.advanceRequestId in (" + advanceRequestIds.toString() + ") \n" + " group by a.advanceRequestId, a.advanceRequestIdDtlId"; rs_fna.executeSql(sql1); while (rs_fna.next()) { HashMap hm = new HashMap(); String keyId = Util.null2String("advanceRequestIdInfo_" + rs_fna.getString("advanceRequestId")).trim() + "_" + Util.null2String(rs_fna.getString("advanceRequestIdDtlId")).trim(); String Yfkje = Util.null2String(rs_fna.getString("Yfkje")).trim(); String yhje = Util.null2String(rs_fna.getString("yhje")).trim(); String spzje = Util.null2String(rs_fna.getString("spzje")).trim(); String whje = Util.null2String(rs_fna.getString("whje")).trim(); hm.put("Yfkje", Yfkje); hm.put("yhje", yhje); hm.put("spzje", spzje); hm.put("whje", whje); retHm.put(keyId, hm); } } return retHm; } /** * 获取单内序号对应显示名称 * * @param jklc 流程reqid * @param dhxh 单内序号 * @return 单内序号对应显示名称 */ public static String getRequestAdvanceDnxhShowName(int jklc, int dhxh) { return FnaCommon.getRequestAdvanceDnxhShowName(jklc, dhxh, null); } /** * 获取单内序号对应显示名称 * * @param jklc 流程reqid * @param dhxh 单内序号 * @param jklcsHm 输出参数 * @return 单内序号对应显示名称 */ public static String getRequestAdvanceDnxhShowName(int jklc, int dhxh, HashMap> jklcsHm) { return FnaCommon.getRequestBorrowDnxhShowName(jklc, dhxh, jklcsHm); } /** * 获取单内序号对应显示名称 * * @param jklc 流程reqid * @param dhxh 单内序号 * @return 单内序号对应显示名称 */ public static String getRequestBorrowDnxhShowName(int jklc, int dhxh) { return FnaCommon.getRequestBorrowDnxhShowName(jklc, dhxh, null); } /** * 获取单内序号对应显示名称 * * @param jklc 流程reqid * @param dhxh 单内序号 * @param jklcsHm 输出参数 * @return 单内序号对应显示名称 */ public static String getRequestBorrowDnxhShowName(int jklc, int dhxh, HashMap> jklcsHm) { RecordSet rs_fna = new RecordSet(); String spanValue = ""; if (jklc > 0 && dhxh > 0) { boolean _flag1 = false; HashMap _jklcDtlIdxHm = null; if (jklcsHm != null) { if (jklcsHm.containsKey(jklc + "")) { _jklcDtlIdxHm = jklcsHm.get(jklc + ""); _flag1 = true; } else { _jklcDtlIdxHm = new HashMap(); jklcsHm.put(jklc + "", _jklcDtlIdxHm); } } if (_flag1) { _flag1 = _jklcDtlIdxHm != null; } if (_flag1) { spanValue = Util.null2String(_jklcDtlIdxHm.get(dhxh + "")).trim(); } else { String sql = "select b.formid \n" + " from workflow_requestbase a \n" + " join workflow_base b on a.workflowid = b.id \n" + " where a.requestid = " + jklc; rs_fna.executeSql(sql); if (rs_fna.next()) { int jklcFormid = Util.getIntValue(rs_fna.getString("formid")); int jklcFormidAbs = Math.abs(jklcFormid); int dtlIdx = 0; sql = "select dt.id dtlId " + " from formtable_main_" + jklcFormidAbs + "_dt1 dt " + " join formtable_main_" + jklcFormidAbs + " main on main.id=dt.mainid " + " where main.requestId=" + jklc + " " + " order by dt.id asc"; rs_fna.executeSql(sql); while (rs_fna.next()) { dtlIdx++; int dtlId = rs_fna.getInt("dtlId"); if (_jklcDtlIdxHm != null) { _jklcDtlIdxHm.put(dtlId + "", dtlIdx + ""); jklcsHm.put(jklc + "", _jklcDtlIdxHm); } if (dtlId == dhxh) { spanValue = dtlIdx + ""; } } } } } return spanValue; } /** * 生成定义成了报销流程的流程表单的数据的查询sql, 适用于明细表1报销的情况 * * @param requestid 流程reqid * @param formidAbs 流程表单id绝对值 * @param dt1_haveIsDtlField 字段中是否包含了至少一个明细表字段 * @param fieldIdOrgType_isDtl 承担主体类型是否是明细表字段 * @param fieldNameOrgType 承担主体类型字段名 * @param fieldIdOrgId_isDtl 承担主体是否是明细表字段 * @param fieldNameOrgId 承担主体字段名 * @param fieldIdSubject_isDtl 科目是否是明细表字段 * @param fieldNameSubject 科目字段名 * @param fieldIdOccurdate_isDtl 费用日期是否是明细表字段 * @param fieldNameOccurdate 费用日期字段名 * @param fieldIdAmount_isDtl 报销金额是否是明细表字段 * @param fieldNameAmount 报销金额字段名 * @param fieldNameRequestidApplication 相关费用预申请流程是否是明细表字段 * @param fieldNameCloseRequestidApplication 相关费用预申请流程字段名 * @param isDebug 是否打印调试日期 * @param isNewWf * @param fieldIdReqId_isDtl * @param fieldNameReqId * @param fieldIdReqDtId_isDtl * @param fieldNameReqDtId * @return SQL */ public static String getFnaWf8Sql(int requestid, int formidAbs, boolean dt1_haveIsDtlField, String fieldIdOrgType_isDtl, String fieldNameOrgType, String fieldIdOrgId_isDtl, String fieldNameOrgId, String fieldIdSubject_isDtl, String fieldNameSubject, String fieldIdOccurdate_isDtl, String fieldNameOccurdate, String fieldIdAmount_isDtl, String fieldNameAmount, String fieldNameRequestidApplication, String fieldNameCloseRequestidApplication, boolean isDebug, boolean isNewWf, String fieldIdReqId_isDtl, String fieldNameReqId, String fieldIdReqDtId_isDtl, String fieldNameReqDtId) { StringBuffer querySql = new StringBuffer("select "); if ("1".equals(fieldIdOrgType_isDtl)) { querySql.append(" dt."); } else { querySql.append(" main."); } querySql.append(fieldNameOrgType + " organizationtype, "); if ("1".equals(fieldIdOrgId_isDtl)) { querySql.append(" dt."); } else { querySql.append(" main."); } querySql.append(fieldNameOrgId + " organizationid, "); if ("1".equals(fieldIdSubject_isDtl)) { querySql.append(" dt."); } else { querySql.append(" main."); } querySql.append(fieldNameSubject + " subject, "); if ("1".equals(fieldIdOccurdate_isDtl)) { querySql.append(" dt."); } else { querySql.append(" main."); } querySql.append(fieldNameOccurdate + " budgetperiod, "); if ("1".equals(fieldIdAmount_isDtl)) { querySql.append(" dt."); } else { querySql.append(" main."); } querySql.append(fieldNameAmount + " applyamount, "); if (isNewWf) { if ("1".equals(fieldIdReqId_isDtl)) { querySql.append(" dt."); } else { querySql.append(" main."); } querySql.append(fieldNameReqId + " ReqId, "); if ("1".equals(fieldIdReqDtId_isDtl)) { querySql.append(" dt."); } else { querySql.append(" main."); } querySql.append(fieldNameReqDtId + " ReqDtId, "); } if (!"".equals(fieldNameRequestidApplication)) { querySql.append(" main." + fieldNameRequestidApplication + " fysqlc, "); } if (!"".equals(fieldNameCloseRequestidApplication)) { querySql.append(" main." + fieldNameCloseRequestidApplication + " sfbxwc, "); } if (dt1_haveIsDtlField) { querySql.append(" dt.id dtlId "); } else { querySql.append(" -987654321 dtlId "); } querySql.append(" from formtable_main_" + formidAbs + " main "); if (dt1_haveIsDtlField) { querySql.append(" join formtable_main_" + formidAbs + "_dt1 dt on main.id=dt.mainid "); } querySql.append(" where main.requestId=" + requestid); if (dt1_haveIsDtlField) { querySql.append(" order by dt.id asc "); } if (isDebug) { new BaseBean().writeLog("FnaCommon -> getFnaWf8Sql -> querySql=" + querySql.toString()); } return querySql.toString(); } /** * 生成定义成了报销流程的流程表单的数据的查询sql, 适用于明细表1报销的情况 * * @param requestid 流程reqid * @param formidAbs 流程表单id绝对值 * @param dt1_haveIsDtlField 字段中是否包含了至少一个明细表字段 * @param fieldIdOrgType_isDtl 承担主体类型是否是明细表字段 * @param fieldNameOrgType 承担主体类型字段名 * @param fieldIdOrgId_isDtl 承担主体是否是明细表字段 * @param fieldNameOrgId 承担主体字段名 * @param fieldIdSubject_isDtl 科目是否是明细表字段 * @param fieldNameSubject 科目字段名 * @param fieldIdOccurdate_isDtl 费用日期是否是明细表字段 * @param fieldNameOccurdate 费用日期字段名 * @param fieldIdAmount_isDtl 报销金额是否是明细表字段 * @param fieldNameAmount 报销金额字段名 * @param fieldNameRequestidApplication 相关费用预申请流程是否是明细表字段 * @param fieldNameCloseRequestidApplication 相关费用预申请流程字段名 * @param isDebug 是否打印调试日期 * @return SQL */ public static String getFnaWf8Sql(int requestid, int formidAbs, boolean dt1_haveIsDtlField, String fieldIdOrgType_isDtl, String fieldNameOrgType, String fieldIdOrgId_isDtl, String fieldNameOrgId, String fieldIdSubject_isDtl, String fieldNameSubject, String fieldIdOccurdate_isDtl, String fieldNameOccurdate, String fieldIdAmount_isDtl, String fieldNameAmount, String fieldNameRequestidApplication, String fieldNameCloseRequestidApplication, boolean isDebug) { return FnaCommon.getFnaWf8Sql(requestid, formidAbs, dt1_haveIsDtlField, fieldIdOrgType_isDtl, fieldNameOrgType, fieldIdOrgId_isDtl, fieldNameOrgId, fieldIdSubject_isDtl, fieldNameSubject, fieldIdOccurdate_isDtl, fieldNameOccurdate, fieldIdAmount_isDtl, fieldNameAmount, fieldNameRequestidApplication, fieldNameCloseRequestidApplication, isDebug, false, null, null, null, null); } /** * 生成定义成了报销流程的流程表单的数据的查询sql, 适用于多明细表报销的情况 * * @param requestid 流程reqid * @param formidAbs 流程表单id绝对值 * @param isDebug 是否打印调试日期 * @return SQL */ public static String getFnaWf8MultiSql(int requestid, int formidAbs, boolean isDebug) { StringBuffer querySql = new StringBuffer(); boolean dt1_haveIsDtlField = true; RecordSet rs = new RecordSet(); rs.executeQuery("select a.workflowid from workflow_requestbase a where a.requestid = ?", requestid); if (rs.next()) { int workflowid = rs.getInt("workflowid"); FnaWfMultiSet fnaWfMultiSet = new FnaWfMultiSet(workflowid, 0, 0); HashMap fieldInfoHm = fnaWfMultiSet.getFieldInfoHm(); List detailTableList = fnaWfMultiSet.getDetailTableList(); int detailTableList_len = detailTableList.size(); new BaseBean().writeLog("detailTableList_len:" + detailTableList_len); for (int i = 0; i < detailTableList_len; i++) { String detailTable = detailTableList.get(i); FnaWfMultiSetFieldInfo fnaWfMultiSetFieldInfo = fieldInfoHm.get(detailTable); if (i > 0) { querySql.append("\r\n UNION ALL \r\n"); } querySql.append(" select "); String zd_orgtype = ""; if (fnaWfMultiSetFieldInfo.getFkCdztlx_dtlNum() > 0) { //querySql.append(" dt."); zd_orgtype = "dt." + fnaWfMultiSetFieldInfo.getFkCdztlx_fieldName(); } else { //querySql.append(" main."); zd_orgtype = "main." + fnaWfMultiSetFieldInfo.getFkCdztlx_fieldName(); } //querySql.append(fnaWfMultiSetFieldInfo.getFkCdztlx_fieldName()+" organizationtype, "); querySql.append(zd_orgtype + " organizationtype, "); //拼接 承担主体ID 的 case when 语句 start String orgid_Case_When = " (CASE "; //承担主体 - 人员 - 字段英文名称 String zd_orgid = fnaWfMultiSetFieldInfo.getFkBxgr_fieldName(); if (fnaWfMultiSetFieldInfo.getFkBxgr_dtlNum() > 0 && zd_orgid != null && !"".equals(zd_orgid)) { orgid_Case_When += (" WHEN " + zd_orgtype + " = 0 THEN dt." + zd_orgid); } else if (zd_orgid != null && !"".equals(zd_orgid)) { orgid_Case_When += (" WHEN " + zd_orgtype + " = 0 THEN main." + zd_orgid); } //承担主体 - 部门 - 字段英文名称 zd_orgid = fnaWfMultiSetFieldInfo.getFkBxbm_fieldName(); if (fnaWfMultiSetFieldInfo.getFkBxbm_dtlNum() > 0 && zd_orgid != null && !"".equals(zd_orgid)) { orgid_Case_When += (" WHEN " + zd_orgtype + " = 1 THEN dt." + zd_orgid); } else if (zd_orgid != null && !"".equals(zd_orgid)) { orgid_Case_When += (" WHEN " + zd_orgtype + " = 1 THEN main." + zd_orgid); } //承担主体 - 分部 - 字段英文名称 zd_orgid = fnaWfMultiSetFieldInfo.getFkBxfb_fieldName(); if (fnaWfMultiSetFieldInfo.getFkBxfb_dtlNum() > 0 && zd_orgid != null && !"".equals(zd_orgid)) { orgid_Case_When += (" WHEN " + zd_orgtype + " = 2 THEN dt." + zd_orgid); } else if (zd_orgid != null && !"".equals(zd_orgid)) { orgid_Case_When += (" WHEN " + zd_orgtype + " = 2 THEN main." + zd_orgid); } //承担主体 - 成本中心 - 字段英文名称 zd_orgid = fnaWfMultiSetFieldInfo.getFkBxcbzx_fieldName(); if (fnaWfMultiSetFieldInfo.getFkBxcbzx_dtlNum() > 0 && zd_orgid != null && !"".equals(zd_orgid)) { orgid_Case_When += (" WHEN " + zd_orgtype + " = 3 THEN dt." + zd_orgid); } else if (zd_orgid != null && !"".equals(zd_orgid)) { orgid_Case_When += (" WHEN " + zd_orgtype + " = 3 THEN main." + zd_orgid); } orgid_Case_When += " ELSE -1 END) "; querySql.append(orgid_Case_When + " organizationid, "); //拼接 承担主体ID 的 case when 语句 end if (fnaWfMultiSetFieldInfo.getFkBxkm_dtlNum() > 0) { querySql.append(" dt."); } else { querySql.append(" main."); } querySql.append(fnaWfMultiSetFieldInfo.getFkBxkm_fieldName() + " subject, "); if (fnaWfMultiSetFieldInfo.getFkFyrq_dtlNum() > 0) { querySql.append(" dt."); } else { querySql.append(" main."); } querySql.append(fnaWfMultiSetFieldInfo.getFkFyrq_fieldName() + " budgetperiod, "); if (fnaWfMultiSetFieldInfo.getFkBxje_dtlNum() > 0) { querySql.append(" dt."); } else { querySql.append(" main."); } querySql.append(fnaWfMultiSetFieldInfo.getFkBxje_fieldName() + " applyamount, "); // if(!"".equals(fieldNameRequestidApplication)){ // querySql.append(" main."+fieldNameRequestidApplication+" fysqlc, "); // } // // if(!"".equals(fieldNameCloseRequestidApplication)){ // querySql.append(" main."+fieldNameCloseRequestidApplication+" sfbxwc, "); // } if (dt1_haveIsDtlField) { querySql.append(" dt.id dtlId, '" + StringEscapeUtils.escapeSql(detailTable) + "' detailtable "); } else { querySql.append(" -987654321 dtlId, '' detailtable "); } querySql.append(" from formtable_main_" + formidAbs + " main "); if (dt1_haveIsDtlField) { querySql.append(" join " + detailTable + " dt on main.id=dt.mainid "); } querySql.append(" where main.requestId=" + requestid + " "); } } if (true) { new BaseBean().writeLog(querySql.toString()); } return querySql.toString(); } /** * 获取流程相关费控信息 * * @param _workflowid * @return 是否是系统表单的费控流程:key:isEnableFnaWfSysWf;value:true、false;
* 是否是启用的Ecology7费控流程:key:isEnableFnaWfE7;value:true、false;
* 是否是启用的Ecology8费控流程:key:isEnableFnaWfE8;value:true、false;
* 流程表单id:key:formId;value:表单id;
* 流程是否新表单:key:isbill;value:0、1; */ public static HashMap getIsEnableFnaWfHm(int _workflowid) { BaseBean _bb = new BaseBean(); RecordSet rs_fna = new RecordSet(); HashMap retHm = new HashMap(); //是否是系统表单的费控流程 retHm.put("isEnableFnaWfSysWf", "false"); int _formId = 0; int _isbill = -1; String sqlFna1 = "select a.formid, a.isbill from workflow_base a where a.id = " + _workflowid; rs_fna.executeSql(sqlFna1); if (rs_fna.next()) { _formId = Util.getIntValue(rs_fna.getString("formid"), 0); _isbill = Util.getIntValue(rs_fna.getString("isbill"), 0); } retHm.put("formId", _formId + ""); retHm.put("isbill", _isbill + ""); //系统表单:报销申请单、付款申请单,也是显示显示预算信息的,需要特殊处理 if ((_formId == 158 || _formId == 156) && _isbill == 1) { retHm.put("isEnableFnaWfSysWf", "true"); } //是否是启用的Ecology7费控流程 retHm.put("isEnableFnaWfE7", "false"); //ecology7中配置的自定义表单费控流程的workflowId,多个id之间使用英文半角,号分隔 String ecology7_FnaWfIds = ""; try { ecology7_FnaWfIds = Util.null2String(new String(Util.null2String(_bb.getPropValue("Ecology7_FnaWf", "ecology7_FnaWfIds")).getBytes("ISO-8859-1"), "gbk")).trim(); } catch (Exception e) { } if (!"".equals(ecology7_FnaWfIds) && _workflowid > 0 && ("," + ecology7_FnaWfIds + ",").indexOf("," + _workflowid + ",") >= 0) { retHm.put("isEnableFnaWfE7", "true"); } //是否是启用的Ecology8费控流程 retHm.put("isEnableFnaWfE8", "false"); //是否是启用的Ecology8借款费控流程 retHm.put("isEnableFnaBorrowWf", "false"); //是否是启用的Ecology8还款费控流程 retHm.put("isEnableFnaRepaymentWf", "false"); //是否是启用的Ecology8预算变更流程 retHm.put("isEnableFnaChangeWf", "false"); //是否是启用的Ecology8预算分摊流程 retHm.put("isEnableFnaShareWf", "false"); //费用报销流程是否启用了还款明细 retHm.put("enableRepayment", "false"); //费用报销流程是否启用了预付款冲销明细 retHm.put("enableReverseAdvance", "false"); //是否是启用的Ecology8预付款费控流程 retHm.put("isEnableFnaAdvanceWf", "false"); String sqlFnaWfSet = "select a.* from fnaFeeWfInfo a where a.workflowid = " + _workflowid; rs_fna.executeSql(sqlFnaWfSet); if (rs_fna.next()) { if (rs_fna.getInt("enable") == 1) { String fnaWfType = Util.null2String(rs_fna.getString("fnaWfType")); if ("fnaFeeWf".equals(fnaWfType)) { retHm.put("isEnableFnaWfE8", "true"); int fnaWfTypeColl = rs_fna.getInt("fnaWfTypeColl"); int fnaWfTypeReverse = rs_fna.getInt("fnaWfTypeReverse"); boolean enableRepayment = (fnaWfTypeReverse > 0 && fnaWfTypeColl > 0); if (enableRepayment) { retHm.put("enableRepayment", "true"); } boolean enableReverseAdvance = rs_fna.getInt("fnaWfTypeReverseAdvance") == 1; if (enableReverseAdvance) { retHm.put("enableReverseAdvance", "true"); } } else if ("borrow".equals(fnaWfType)) { retHm.put("isEnableFnaBorrowWf", "true"); } else if ("repayment".equals(fnaWfType)) { retHm.put("isEnableFnaRepaymentWf", "true"); } else if ("change".equals(fnaWfType)) { retHm.put("isEnableFnaChangeWf", "true"); } else if ("share".equals(fnaWfType)) { retHm.put("isEnableFnaShareWf", "true"); } else if ("advance".equals(fnaWfType)) { retHm.put("isEnableFnaAdvanceWf", "true"); } } } return retHm; } /** * 从session中获取预算编制编辑页面,编辑单尚未保存到数据库中的新预算额度 * * @param session * @param guid1 编辑页面guid1 * @param tabFeeperiod 预算周期:月度:M;季度:Q;半年度:H;年度:Y; * @param subject 三级科目id * @param budgetperiodslist 预算周期期间数:月度:(1~12);季度:(1~4);半年度:(1~2);年度:(1); * @param currentAmt 从数据库中获取的当前预算金额,如果session中不存在则返回该金额 * @return */ public static double getBudgetEditNewAmtByGuid(HttpSession session, String guid1, String tabFeeperiod, int subject, int budgetperiodslist, double currentAmt) { List mbudgetvalues = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_mbudgetvalues_" + guid1); List msubject3names = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_msubject3names_" + guid1); List qbudgetvalues = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_qbudgetvalues_" + guid1); List qsubject3names = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_qsubject3names_" + guid1); List hbudgetvalues = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_hbudgetvalues_" + guid1); List hsubject3names = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_hsubject3names_" + guid1); List ybudgetvalues = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_ybudgetvalues_" + guid1); List ysubject3names = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_ysubject3names_" + guid1); List budgetValues = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_budgetValues_" + guid1); List subjectNames = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_subjectNames_" + guid1); if (mbudgetvalues == null) { mbudgetvalues = new ArrayList(); msubject3names = new ArrayList(); } if (qbudgetvalues == null) { qbudgetvalues = new ArrayList(); qsubject3names = new ArrayList(); } if (hbudgetvalues == null) { hbudgetvalues = new ArrayList(); hsubject3names = new ArrayList(); } if (ybudgetvalues == null) { ybudgetvalues = new ArrayList(); ysubject3names = new ArrayList(); } if (budgetValues == null) { budgetValues = new ArrayList(); subjectNames = new ArrayList(); } return FnaCommon.getBudgetEditNewAmt(tabFeeperiod, subject, budgetperiodslist, currentAmt, mbudgetvalues, msubject3names, qbudgetvalues, qsubject3names, hbudgetvalues, hsubject3names, ybudgetvalues, ysubject3names, budgetValues, subjectNames); } /** * 从session中获取和List中获取,预算编制编辑页面,编辑单尚未保存到数据库中的新预算额度 * * @param tabFeeperiod 预算周期:月度:M;季度:Q;半年度:H;年度:Y; * @param subject 科目id * @param budgetperiodslist 预算周期期间数:月度:(1~12);季度:(1~4);半年度:(1~2);年度:(1); * @param currentAmt 从数据库中获取的当前预算金额,如果session中不存在则返回该金额 * @param mbudgetvalues * @param msubject3names * @param qbudgetvalues * @param qsubject3names * @param hbudgetvalues * @param hsubject3names * @param ybudgetvalues * @param ysubject3names * @param budgetValues * @param subjectNames * @return */ public static double getBudgetEditNewAmt(String tabFeeperiod, int subject, int budgetperiodslist, double currentAmt, List mbudgetvalues, List msubject3names, List qbudgetvalues, List qsubject3names, List hbudgetvalues, List hsubject3names, List ybudgetvalues, List ysubject3names, List budgetValues, List subjectNames) { DecimalFormat df = new DecimalFormat("####################################################0.00"); double _ysze = currentAmt; String _yszeStr = df.format(_ysze); if ("M".equals(tabFeeperiod)) { int _idx = msubject3names.indexOf(subject + ""); if (_idx >= 0) { try { String[] _valArray = (String[]) mbudgetvalues.get(_idx); _yszeStr = Util.null2String(_valArray[budgetperiodslist - 1]).trim(); _ysze = Util.getDoubleValue(_yszeStr, 0.00); } catch (Exception ex1) { new BaseBean().writeLog(ex1); } } } else if ("Q".equals(tabFeeperiod)) { int _idx = qsubject3names.indexOf(subject + ""); if (_idx >= 0) { try { String[] _valArray = (String[]) qbudgetvalues.get(_idx); _yszeStr = Util.null2String(_valArray[budgetperiodslist - 1]).trim(); _ysze = Util.getDoubleValue(_yszeStr, 0.00); } catch (Exception ex1) { new BaseBean().writeLog(ex1); } } } else if ("H".equals(tabFeeperiod)) { int _idx = hsubject3names.indexOf(subject + ""); if (_idx >= 0) { try { String[] _valArray = (String[]) hbudgetvalues.get(_idx); _yszeStr = Util.null2String(_valArray[budgetperiodslist - 1]).trim(); _ysze = Util.getDoubleValue(_yszeStr, 0.00); } catch (Exception ex1) { new BaseBean().writeLog(ex1); } } } else if ("Y".equals(tabFeeperiod)) { int _idx = ysubject3names.indexOf(subject + ""); if (_idx >= 0) { try { String[] _valArray = (String[]) ybudgetvalues.get(_idx); _yszeStr = Util.null2String(_valArray[budgetperiodslist - 1]).trim(); _ysze = Util.getDoubleValue(_yszeStr, 0.00); } catch (Exception ex1) { new BaseBean().writeLog(ex1); } } } int _idx = subjectNames.indexOf(subject + ""); if (_idx >= 0) { try { String[] _valArray = (String[]) budgetValues.get(_idx); _yszeStr = Util.null2String(_valArray[budgetperiodslist - 1]).trim(); _ysze = Util.getDoubleValue(_yszeStr, 0.00); } catch (Exception ex1) { new BaseBean().writeLog(ex1); } } return Util.getDoubleValue(df.format(_ysze)); } /** * 获得并保存预算编制界面分页每页行数 * * @param pageSize * @param defPageSize * @param userId * @return */ public static int getAndSaveFnaBudgetInfoPageSize(int pageSize, int defPageSize, int userId) { RecordSet rs = new RecordSet(); if (pageSize <= 0) { pageSize = defPageSize; rs.executeQuery("select pageSize from FnaBudgetInfoPageSize where userId=?", userId); if (rs.next()) { pageSize = Util.getIntValue(rs.getString("pageSize"), 50); } } if (pageSize <= 0) { pageSize = defPageSize; } rs.executeQuery("select * from FnaBudgetInfoPageSize where userId=?", userId); if (rs.next()) { String _id = rs.getString("id"); int _pageSize = rs.getInt("pageSize"); if (pageSize != _pageSize) { rs.executeUpdate("update FnaBudgetInfoPageSize set pageSize = ? where id = ?", pageSize, _id); } } else { rs.executeUpdate("delete from FnaBudgetInfoPageSize where userId=?", userId); rs.executeUpdate("insert into FnaBudgetInfoPageSize (userId, pageSize) values (?, ?)", userId, pageSize); } return pageSize; } /** * 转义 & " ' < > 空格 这些html特殊字符
* str始终先进行trim后再进行转义处理 * * @param str * @return */ public static String escapeHtmlTrim(String str) { return FnaCommon.escapeHtml(Util.null2String(str).trim()); } /** * 转义 & " ' < > 空格 这些html特殊字符
* str=null,直接返回空字符串 * * @param str * @return */ public static String escapeHtmlNull(String str) { if (str == null) { return ""; } else { return FnaCommon.escapeHtml(str); } } /** * 转义 & " ' < > 空格 这些html特殊字符 * * @param str * @return */ public static String escapeHtml(String str) { if (str == null || "".equals(str)) { return str; } return str .replaceAll("\\&", "&") .replaceAll("\"", """) .replaceAll("\'", "'") .replaceAll("\\<", "<") .replaceAll("\\>", ">") ; } /** * 转义 & " ' < > 这些xml特殊字符 * * @param str * @return */ public static String escapeXml(String str) { if (str == null || "".equals(str)) { return str; } return str .replaceAll("\\&", "&") .replaceAll("\"", """) .replaceAll("\'", "'") .replaceAll("\\<", "<") .replaceAll("\\>", ">") ; } /** * 将url参数值中的被转义的编码解码成实际的值 * * @param str * @return */ public static String decodeURL(String str) { if (str == null || "".equals(str)) { return str; } return str .replaceAll("%20", " ") .replaceAll("%22", "\"") .replaceAll("%23", "#") .replaceAll("%28", "(") .replaceAll("%29", ")") .replaceAll("%2B", "+") .replaceAll("%2C", ",") .replaceAll("%2F", "/") .replaceAll("%3A", ":") .replaceAll("%3B", ";") .replaceAll("%3C", "<") .replaceAll("%3D", "=") .replaceAll("%3E", ">") .replaceAll("%3F", "?") .replaceAll("%4o", "@") .replaceAll("%5C", "\\\\") .replaceAll("%7C", "|") .replaceAll("%26", "&") .replaceAll("%25", "%") ; } /** * 给url参数值转义成url中可以传送的编码 * * @param str * @return */ public static String encodeURL(String str) { if (str == null || "".equals(str)) { return str; } return str .replaceAll("\\%", "%25") .replaceAll("\\&", "%26") .replaceAll(" ", "%20") .replaceAll("\"", "%22") .replaceAll("\\#", "%23") .replaceAll("\\(", "%28") .replaceAll("\\)", "%29") .replaceAll("\\+", "%2B") .replaceAll("\\,", "%2C") .replaceAll("\\/", "%2F") .replaceAll("\\:", "%3A") .replaceAll("\\;", "%3B") .replaceAll("\\<", "%3C") .replaceAll("\\=", "%3D") .replaceAll("\\>", "%3E") .replaceAll("\\?", "%3F") .replaceAll("\\@", "%4o") .replaceAll("\\\\", "%5C") .replaceAll("\\|", "%7C") ; } /** * 系统表单 * 获得相应具体某个流程流转中某个字段是否可编辑状态(只要有任意一个节点是可编辑状态即返回true) * * @param fieldName * @param requestId * @param currentNodeId * @param detailtable * @return */ public static boolean isEditFieldByReqId(String fieldName, int requestId, int currentNodeId, String detailtable) { boolean isEdit = FnaCommon.isEditField(fieldName, currentNodeId, detailtable); if (isEdit) { return true; } if (requestId > 0) { RecordSet rs = new RecordSet(); //签字类型:0:批准;1:保存;2:提交;3:退回;4:重新打开;5:删除;6:激活;7:转发;9:批注;e:强制归档;t:抄送;s:督办;i:??; rs.executeSql("select DISTINCT nodeid from workflow_requestLog where logtype in ('0','2') and requestid = " + requestId); while (rs.next()) { int nodeid = rs.getInt("nodeid"); isEdit = FnaCommon.isEditField(fieldName, nodeid, detailtable); if (isEdit) { return true; } } } return false; } /** * 系统表单 * 获得相应节点中某个字段是否是可编辑状态 * * @param fieldName 字段名称 * @param nodeid 节点id * @param detailtable * @return */ public static boolean isEditField(String fieldName, int nodeid, String detailtable) { List> fieldList = FnaCommon.getWfFieldFormInfoByNodeId(nodeid); return FnaCommon.isEditField(fieldName, fieldList, detailtable); } /** * 系统表单 * 获得相应节点字段list中某个字段是否是可编辑状态 * * @param fieldName 字段名称 * @param fieldList 节点字段list * @param detailtable 明细表表名 * @return */ public static boolean isEditField(String fieldName, List> fieldList, String detailtable) { int fieldListLen = fieldList.size(); for (int i = 0; i < fieldListLen; i++) { HashMap fieldHm = (HashMap) fieldList.get(i); String _isedit = Util.null2String(fieldHm.get("isedit")); String _fieldname = Util.null2String(fieldHm.get("fieldname")); String _detailtable = Util.null2String(fieldHm.get("detailtable")); if (_fieldname.equalsIgnoreCase(fieldName) && _detailtable.equalsIgnoreCase(detailtable)) { if ("1".equalsIgnoreCase(_isedit)) { return true; } return false; } } return false; } /** * 系统表单 * 获得对应流程节点,所有表单字段查看编辑状态: * fieldid;isview;isedit;ismandatory;orderid;dsporder;fieldname;detailtable; * * @param nodeid 节点id * @return List> 节点字段list */ public static List> getWfFieldFormInfoByNodeId(int nodeid) { RecordSet rs = new RecordSet(); RecordSet rs1 = new RecordSet(); List> fieldList = new ArrayList>(); rs.executeProc("workflow_FieldForm_Select", nodeid + ""); while (rs.next()) { String fieldid = Util.null2String(rs.getString("fieldid")).trim(); String isview = Util.null2String(rs.getString("isview")).trim(); String isedit = Util.null2String(rs.getString("isedit")).trim(); String ismandatory = Util.null2String(rs.getString("ismandatory")).trim(); String orderid = Util.null2String(rs.getString("orderid")).trim(); String dsporder = Util.null2String(rs.getString("dsporder")).trim(); String fieldname = ""; String detailtable = ""; String sql1 = "SELECT fieldname, detailtable FROM workflow_billfield where id = " + fieldid; rs1.executeSql(sql1); if (rs1.next()) { fieldname = Util.null2String(rs1.getString("fieldname")).trim(); detailtable = Util.null2String(rs1.getString("detailtable")).trim(); } HashMap fieldHm = new HashMap(); fieldHm.put("fieldid", fieldid); fieldHm.put("isview", isview); fieldHm.put("isedit", isedit); fieldHm.put("ismandatory", ismandatory); fieldHm.put("orderid", orderid); fieldHm.put("dsporder", dsporder); fieldHm.put("fieldname", fieldname); fieldHm.put("detailtable", detailtable); fieldList.add(fieldHm); } return fieldList; } /** * 保存系统日志 * 关于系统日志属性改造的说明 * * @param relatedId 处理记录id * @param relatedName 处理记录名称 * @param operateType SptmForCowork.getTypeName * @param operateDesc 操作的类型 * @param operateItem * @param operateUserid 操作用户id * @param clientAddress 客户端ip地址 * @param operatesmalltype 系统维护类型(默认值):SysMaintenanceLog.OPERATE_0;系统操作类型: SysMaintenanceLog.OPERATE_1; */ public void saveSysLogInfo(int relatedId, String relatedName, String operateType, String operateDesc, String operateItem, int operateUserid, String clientAddress, int operatesmalltype) { try { SysMaintenanceLog log = new SysMaintenanceLog(); log.resetParameter(); log.setRelatedId(relatedId); log.setRelatedName(relatedName); log.setOperateType(operateType); log.setOperateDesc(operateDesc); log.setOperateItem(operateItem); log.setOperateUserid(operateUserid); log.setClientAddress(clientAddress); log.setOperatesmalltype(operatesmalltype); log.setSysLogInfo(); } catch (Exception e) { new BaseBean().writeLog(e); } } /** * 流程存为新版时:处理财务模块相关多版本支持代码 * * @param oldWfId 原流程(版本) * @param newWfId 新流程(版本) */ public static void fnaSaveAsVersion(int oldWfId, int newWfId) throws Exception { fnaSaveAsVersion(oldWfId, newWfId, "", null); } /** * 流程存为新版时:处理财务模块相关多版本支持代码 * * @param oldWfId 原流程(版本) * @param newWfId 新流程(版本) */ public static void fnaSaveAsVersion(int oldWfId, int newWfId, String ip, User user) throws Exception { if (oldWfId <= 0 || newWfId <= 0) { return; } RecordSet rs1 = new RecordSet(); RecordSet rs2 = new RecordSet(); WorkflowVersion wfVer = new WorkflowVersion(); String sql1 = ""; if (true) { sql1 = "select * from wf_fna_initWfInfo where workflowId = " + oldWfId; rs1.executeSql(sql1); if (rs1.next()) { int _formid = rs1.getInt("formId"); int _fnaWfType1 = rs1.getInt("fnaWfType1"); int _fnaWfType2 = rs1.getInt("fnaWfType2"); FnaWfInitE8.save_wf_fna_initWfInfo(newWfId, _formid, _fnaWfType1, _fnaWfType2); } } if (true) {//处理:路径设置》高级设置》浏览数据定义: sql1 = "select count(*) cnt from FnaFeetypeWfbrowdef where workflowid = " + newWfId; rs1.executeSql(sql1); if (!rs1.next() || rs1.getInt("cnt") <= 0) { sql1 = "select * from FnaFeetypeWfbrowdef where workflowid = " + oldWfId; rs1.executeSql(sql1); while (rs1.next()) { int oldMainid = (rs1.getInt("id")); int fieldid = (rs1.getInt("fieldid")); int viewtype = (rs1.getInt("viewtype")); int fieldtype = (rs1.getInt("fieldtype")); String title = (rs1.getString("title")); String sql2 = ""; sql2 = "insert into FnaFeetypeWfbrowdef(workflowid,fieldId,viewType,fieldType,title)\n" + " values " + " (" + newWfId + "," + fieldid + "," + viewtype + "," + fieldtype + ",'" + StringEscapeUtils.escapeSql(title) + "')"; rs2.executeSql(sql2); sql2 = "select max(id) maxid from FnaFeetypeWfbrowdef where fieldId = " + fieldid + " and workflowid = " + newWfId; rs2.executeSql(sql2); if (rs2.next()) { int newMainid = rs2.getInt("maxid"); sql2 = "insert into Fnafeetypewfbrowdef_Dt1 (mainid,refid)" + " select " + newMainid + ",refid from Fnafeetypewfbrowdef_Dt1 b where b.mainid =" + oldMainid; rs2.executeSql(sql2); } } } } sql1 = "select count(*) cnt from fnafeewfinfo where workflowid = " + oldWfId; rs1.executeSql(sql1); if (rs1.next() && rs1.getInt("cnt") > 0) { } else { sql1 = "select a.activeVersionID from workflow_base a where id = " + oldWfId; rs1.executeSql(sql1); if (rs1.next()) { int activeVersionID = rs1.getInt("activeVersionID"); if (activeVersionID > 0) { sql1 = "select a.id, a.workflowname, a.version, a.activeVersionID from workflow_base a \n" + " where a.activeVersionID = " + activeVersionID + " \n" + " order by case when (a.version is null or a.version = '') then 1 else a.version end DESC"; rs1.executeSql(sql1); while (rs1.next()) { int wf_id = rs1.getInt("id"); String sql2 = "select count(*) cnt from fnafeewfinfo where workflowid = " + wf_id; rs2.executeSql(sql2); if (rs2.next() && rs2.getInt("cnt") > 0) { oldWfId = wf_id; break; } } } } } if (true) {//费用流程凭证集成配置 RecordSet rs3 = new RecordSet(); String dbtype = rs2.getDBType(); if (dbtype.equals("oracle") && rs2.getOrgindbtype().equals("dm")) dbtype = "dm"; String guid1SQlStr = FnaCommon.getPrimaryKeyGuid1SqlStr(dbtype); sql1 = "select count(*) cnt from fnaVoucherXml where workflowid = " + newWfId; rs1.executeSql(sql1); if (!rs1.next() || rs1.getInt("cnt") <= 0) { sql1 = "select id, xmlname, xmlmemo, xmlversion, xmlencoding, " +//1 " workflowid, typename, datasourceid, interfacesaddress, profession " +//2 " from fnavoucherxml " + " where workflowid = " + oldWfId; rs1.executeSql(sql1); while (rs1.next()) { //1 int oldFnaVoucherXmlId = rs1.getInt("id"); String xmlname = Util.null2String(rs1.getString("xmlname")).trim(); String xmlmemo = Util.null2String(rs1.getString("xmlmemo")).trim(); String xmlversion = Util.null2String(rs1.getString("xmlversion")).trim(); String xmlencoding = Util.null2String(rs1.getString("xmlencoding")).trim(); //2 // int workflowid = rs1.getInt("workflowid"); String typename = Util.null2String(rs1.getString("typename")).trim(); String datasourceid = Util.null2String(rs1.getString("datasourceid")).trim(); String interfacesaddress = Util.null2String(rs1.getString("interfacesaddress")).trim(); int profession = rs1.getInt("profession"); String sql2 = ""; sql2 = "insert into fnavoucherxml\n" + " (xmlname, xmlmemo, xmlversion, xmlencoding, " +//1 " workflowid, typename, datasourceid, interfacesaddress, profession)\n" +//2 " values\n" + " ('" + StringEscapeUtils.escapeSql(xmlname) + "', '" + StringEscapeUtils.escapeSql(xmlmemo) + "', '" + StringEscapeUtils.escapeSql(xmlversion) + "', '" + StringEscapeUtils.escapeSql(xmlencoding) + "', " +//1 " " + newWfId + ", '" + StringEscapeUtils.escapeSql(typename) + "', '" + StringEscapeUtils.escapeSql(datasourceid) + "', '" + StringEscapeUtils.escapeSql(interfacesaddress) + "', " + profession + ")";//2 rs2.executeSql(sql2); sql2 = "select max(id) maxid from fnavoucherxml where workflowid = " + newWfId; rs2.executeSql(sql2); if (rs2.next()) { int newFnaVoucherXmlId = rs2.getInt("maxid"); if ("mysql".equalsIgnoreCase(dbtype)) { //TODO 经过排查客户问题,发现针对mysql数据库,函数 replace(uuid(),'-','') 会出现UUID重复的情况,导致SQL执行失败,报主键重复 //修改为 批量插入 List paraList = new ArrayList(); sql2 = " select fieldname, fieldvaluetype1, fieldvaluetype2, " +//1 " fielddbtbname, detailtable, fielddbname, fielddbtype, datasourceid, " +//2 " fieldvalue "+//3 " from fnafinancesetting " + " where fnaVoucherXmlId = "+oldFnaVoucherXmlId; while(rs3.next()){ String fieldname = Util.null2String(rs3.getString("fieldname")); String fieldvaluetype1 = Util.null2String(rs3.getString("fieldvaluetype1")); String fieldvaluetype2 = Util.null2String(rs3.getString("fieldvaluetype2")); String fielddbtbname = Util.null2String(rs3.getString("fielddbtbname")); String detailtable = Util.null2String(rs3.getString("detailtable")); String fielddbname = Util.null2String(rs3.getString("fielddbname")); String fielddbtype = Util.null2String(rs3.getString("fielddbtype")); String datasourceids = Util.null2String(rs3.getString("datasourceid")); String fieldvalue = Util.null2String(rs3.getString("fieldvalue")); String guid1 = FnaCommon.getPrimaryKeyGuid1(); paraList.add("" + guid1 + Util.getSeparator() + newFnaVoucherXmlId + Util.getSeparator() + fieldname + Util.getSeparator() + fieldvaluetype1 + Util.getSeparator() + fieldvaluetype2 //1 + Util.getSeparator() + fielddbtbname + Util.getSeparator() + detailtable + Util.getSeparator() + fielddbname + Util.getSeparator() + fielddbtype + Util.getSeparator() + datasourceids //2 + Util.getSeparator() + fieldvalue //3 ); } //while end BatchRecordSet brs = new BatchRecordSet(); brs.executeSqlBatch( "insert into fnafinancesetting \n" + " (guid1, fnavoucherxmlid, fieldname, fieldvaluetype1, fieldvaluetype2, " +//1 " fielddbtbname, detailtable, fielddbname, fielddbtype, datasourceid, " +//2 " fieldvalue)\n" + //3 " values(?,?,?,?,?,?,?,?,?,?,?)", paraList); }else{ sql2 = "insert into fnafinancesetting\n" + " (guid1, fnavoucherxmlid, fieldname, fieldvaluetype1, fieldvaluetype2, " +//1 " fielddbtbname, detailtable, fielddbname, fielddbtype, datasourceid, " +//2 " fieldvalue)\n" + //3 " select " + guid1SQlStr + ", " + newFnaVoucherXmlId + ", fieldname, fieldvaluetype1, fieldvaluetype2, " +//1 " fielddbtbname, detailtable, fielddbname, fielddbtype, datasourceid, " +//2 " fieldvalue " +//3 " from fnafinancesetting " + " where fnaVoucherXmlId = " + oldFnaVoucherXmlId; rs2.executeSql(sql2); } sql2 = "insert into fnavoucherxmlcontent\n" + " (fnavoucherxmlid, contenttype, contentparentid, contentname, contentvaluetype, " +//1 " contentmemo, orderid, isnullnotprint, contentvalue, parameter, " +//2 " isnullnotprintnode, oldId)\n" + //3 " select " + newFnaVoucherXmlId + ", contenttype, contentparentid, contentname, contentvaluetype, " +//1 " contentmemo, orderid, isnullnotprint, contentvalue, parameter, " +//2 " isnullnotprintnode, id " +//3 " from fnavoucherxmlcontent " + " where fnavoucherxmlid = " + oldFnaVoucherXmlId; rs2.executeSql(sql2); List newFnavoucherxmlcontentid_list = new ArrayList(); List oldContentparentid_list = new ArrayList(); HashMap fnavoucherxmlcontentid_hm = new HashMap(); sql2 = "select * from fnavoucherxmlcontent where fnavoucherxmlid = " + newFnaVoucherXmlId; rs2.executeSql(sql2); while (rs2.next()) { int newFnavoucherxmlcontentid = Util.getIntValue(rs2.getString("id"), 0); int oldFnavoucherxmlcontentid = Util.getIntValue(rs2.getString("oldId"), 0); int oldContentparentid = Util.getIntValue(rs2.getString("contentparentid"), 0); newFnavoucherxmlcontentid_list.add(newFnavoucherxmlcontentid + ""); oldContentparentid_list.add(oldContentparentid + ""); fnavoucherxmlcontentid_hm.put(oldFnavoucherxmlcontentid + "", newFnavoucherxmlcontentid + ""); } int newFnavoucherxmlcontentid_listLen = newFnavoucherxmlcontentid_list.size(); for (int i = 0; i < newFnavoucherxmlcontentid_listLen; i++) { int newFnavoucherxmlcontentid = Util.getIntValue(newFnavoucherxmlcontentid_list.get(i), 0); int oldContentparentid = Util.getIntValue(oldContentparentid_list.get(i), 0); int newContentparentid = Util.getIntValue(fnavoucherxmlcontentid_hm.get(oldContentparentid + ""), 0); String sql3 = "update fnavoucherxmlcontent " + " set contentparentid = " + newContentparentid + " " + " where id = " + newFnavoucherxmlcontentid; rs3.executeSql(sql3); } sql2 = "insert into fnavoucherxmlcontentdset\n" + " (fnavoucherxmlid, fnavoucherxmlcontentid, dsetalias, inittiming, fnadatasetid, " +//1 " dsetmemo, orderid, parameter)\n" + //2 " select " + newFnaVoucherXmlId + ", fnavoucherxmlcontentid, dsetalias, inittiming, fnadatasetid, " +//1 " dsetmemo, orderid, parameter " +//2 " from fnavoucherxmlcontentdset " + " where fnavoucherxmlid = " + oldFnaVoucherXmlId; rs2.executeSql(sql2); sql2 = "select * from fnavoucherxmlcontentdset where fnavoucherxmlid = " + newFnaVoucherXmlId; rs2.executeSql(sql2); while (rs2.next()) { int newFnavoucherxmlcontentdsetid = Util.getIntValue(rs2.getString("id"), 0); int oldFnavoucherxmlcontentid = Util.getIntValue(rs2.getString("fnavoucherxmlcontentid"), 0); int newFnavoucherxmlcontentid = Util.getIntValue(fnavoucherxmlcontentid_hm.get(oldFnavoucherxmlcontentid + ""), 0); String sql3 = "update fnavoucherxmlcontentdset " + " set contentparentid = " + newFnavoucherxmlcontentid + " " + " where id = " + newFnavoucherxmlcontentdsetid; rs3.executeSql(sql3); } } } } } if (true) {//处理:费控流程定义 // 10 fnaFeeWfInfo 费控流程定义表 // 11 fnaFeeWfInfoField 费控流程字段对应关系定义表 // 12 fnaFeeWfInfoLogic 费控流程提交校验定义表 // Fnafeewfinfologicreverse // fnaFeeWfInfoLogicAdvanceR // fnafeewfinfonodectrl // fnaControlScheme_FeeWfInfo RecordSet rs3 = new RecordSet(); RecordSet rs4 = new RecordSet(); sql1 = "select count(*) cnt from fnafeewfinfo where workflowid = " + newWfId; rs1.executeSql(sql1); if (!rs1.next() || rs1.getInt("cnt") <= 0) { boolean need_removeCache_fnaFeeWfInfoComInfo = false; sql1 = "select * " +//3 " from fnafeewfinfo " + " where workflowid = " + oldWfId; rs1.executeSql(sql1); while (rs1.next()) { need_removeCache_fnaFeeWfInfoComInfo = true; //1 int oldMainid = rs1.getInt("id"); // int workflowid = rs1.getInt("workflowid"); int enable = rs1.getInt("enable"); String lastmodifieddate = Util.null2String(rs1.getString("lastmodifieddate")).trim(); String templatefile = Util.null2String(rs1.getString("templatefile")).trim(); //2 String templatefilemobile = Util.null2String(rs1.getString("templatefilemobile")).trim(); String fnawftype = Util.null2String(rs1.getString("fnawftype")).trim(); int fnawftypeborrow = rs1.getInt("fnawftypeborrow"); int fnawftypecoll = rs1.getInt("fnawftypecoll"); int fnawftypereverse = rs1.getInt("fnawftypereverse"); //3 int fnawftypereim = rs1.getInt("fnawftypereim"); String overstandardtips = Util.null2String(rs1.getString("overstandardtips")).trim(); int isallnodescontrol = rs1.getInt("isallnodescontrol"); int fnaWfTypeReverseAdvance = Util.getIntValue(rs1.getString("fnaWfTypeReverseAdvance"), 0); int budgetCanBeNegative = Util.getIntValue(rs1.getString("budgetCanBeNegative"), 0); //多明细 start int fnaWfTypeMultiReim = Util.getIntValue(rs1.getString("fnaWfTypeMultiReim"), 0);//启用多明细表报销 //启用多明细表报销,开关开启:当前流程的任意明细表都 【 可以用于也仅可以用于 】 费用报销;不再支持"还款,预付款冲销"功能; if (fnaWfTypeMultiReim == 1) { fnawftypecoll = 0;//启用还款业务逻辑 fnawftypereverse = 0;//启用冲销业务逻辑 fnaWfTypeReverseAdvance = 0;//启用预申请业务逻辑 sql1 = " insert into fnaFeeWfInfoMultiField(workflowId,dtlIdx,fieldName,fieldFnaType, fieldMemo) " + " select " + newWfId + ",dtlIdx,fieldName,fieldFnaType, fieldMemo from fnaFeeWfInfoMultiField where workflowId = " + oldWfId; rs2.executeSql(sql1); } //多明细 end //承担主体无预算自动向上查询 总开关; 0=默认=关闭; 1=开启 int noBudgetQueryUp = Util.getIntValue(rs1.getString("noBudgetQueryUp"), 0); //承担主体无预算时自动向上查询 分部; 0=默认=关闭; 1=开启=逐级查询上级分部 int noBudgetQueryUp1 = Util.getIntValue(rs1.getString("noBudgetQueryUp1"), 0); //承担主体无预算时自动向上查询 部门; 0=默认=关闭; 1=开启=逐级查询上级部门; 2=开启=逐级查询上级部门及分部 int noBudgetQueryUp2 = Util.getIntValue(rs1.getString("noBudgetQueryUp2"), 0); //承担主体无预算时自动向上查询 人员; 0=默认=关闭; 1=开启=逐级查询上级部门; 2=开启=逐级查询上级部门及分部 int noBudgetQueryUp3 = Util.getIntValue(rs1.getString("noBudgetQueryUp3"), 0); String sql2 = ""; sql2 = "insert into fnafeewfinfo\n" + " (workflowid, enable, lastmodifieddate, templatefile, " +//1 " templatefilemobile, fnawftype, fnawftypeborrow, fnawftypecoll, fnawftypereverse, " +//2 " fnawftypereim, overstandardtips, isallnodescontrol, fnaWfTypeReverseAdvance, " + " budgetCanBeNegative, " + " noBudgetQueryUp, " + " noBudgetQueryUp1, " + " noBudgetQueryUp2, " + " noBudgetQueryUp3, " + " fnaWfTypeMultiReim)\n" + //3 " values\n" + " (" + newWfId + ", " + enable + ", '" + StringEscapeUtils.escapeSql(lastmodifieddate) + "', '" + StringEscapeUtils.escapeSql(templatefile) + "', " +//1 " '" + StringEscapeUtils.escapeSql(templatefilemobile) + "', '" + StringEscapeUtils.escapeSql(fnawftype) + "', " + fnawftypeborrow + ", " + fnawftypecoll + ", " + fnawftypereverse + ", " +//2 " " + fnawftypereim + ", '" + StringEscapeUtils.escapeSql(overstandardtips) + "', " + isallnodescontrol + ", " + fnaWfTypeReverseAdvance + ", " + budgetCanBeNegative + ", " + noBudgetQueryUp + ", " + noBudgetQueryUp1 + ", " + noBudgetQueryUp2 + ", " + noBudgetQueryUp3 + ", " + fnaWfTypeMultiReim + ")";//3 rs2.executeSql(sql2); sql2 = "select max(id) maxid from fnafeewfinfo where workflowid = " + newWfId; rs2.executeSql(sql2); if (rs2.next()) { int newMainid = rs2.getInt("maxid"); String sql3 = "select fnaControlSchemeId from fnaControlScheme_FeeWfInfo where fnaFeeWfInfoId = " + oldMainid; rs3.executeSql(sql3); while (rs3.next()) { int fnaControlSchemeId = rs3.getInt("fnaControlSchemeId"); String sql4 = "insert into fnaControlScheme_FeeWfInfo (fnaControlSchemeId, fnaFeeWfInfoId) values (" + fnaControlSchemeId + ", " + newMainid + ")"; rs4.executeSql(sql4); } sql2 = "insert into fnafeewfinfofield\n" + " (mainid, workflowid, formid, fieldtype, fieldid, " +//1 " isdtl, showalltype, dtlnumber, fieldvalue, fieldvaltype, " +//2 " fcsguid1, fieldvaluewfsys, tabindex, " +//3 " isWfFieldLinkage, controlflowSubmission, automaticTake, controlBorrowingWf) \n" + //4 " select " + newMainid + ", " + newWfId + ", formid, fieldtype, fieldid, " +//1 " isdtl, showalltype, dtlnumber, fieldvalue, fieldvaltype, " +//2 " fcsguid1, fieldvaluewfsys, tabindex, " +//3 " isWfFieldLinkage, controlflowSubmission, automaticTake, controlBorrowingWf " +//4 " from fnafeewfinfofield " + " where workflowid = " + oldWfId + " " + " and mainid = " + oldMainid; rs2.executeSql(sql2); sql2 = "insert into fnafeewfinfologic\n" + " (mainid, kmidscondition, kmids, orgtype, orgidscondition, " +//1 " orgids, intensity, promptsc, prompttc, prompten, " +//2 " totalamtverification, isapplicationbudgetwf)\n" + //3 " select " + newMainid + ", kmidscondition, kmids, orgtype, orgidscondition, " +//1 " orgids, intensity, promptsc, prompttc, prompten, " +//2 " totalamtverification, isapplicationbudgetwf " +//3 " from fnafeewfinfologic " + " where mainid = " + oldMainid; rs2.executeSql(sql2); sql2 = "insert into fnafeewfinfologicreverse\n" + " (mainid, rule1, rule1intensity, rule2, rule2intensity, " +//1 " rule3, rule3intensity, rule4, rule4intensity, rule5, " +//2 " rule5intensity, promptsc, prompttc, prompten, promptsc2, " +//3 " prompttc2, prompten2, promptsc3, prompttc3, prompten3, " +//4 " promptsc4, prompttc4, prompten4, promptsc5, prompttc5, " +//5 " prompten5)\n" + //6 " select " + newMainid + ", rule1, rule1intensity, rule2, rule2intensity, " +//1 " rule3, rule3intensity, rule4, rule4intensity, rule5, " +//2 " rule5intensity, promptsc, prompttc, prompten, promptsc2, " +//3 " prompttc2, prompten2, promptsc3, prompttc3, prompten3, " +//4 " promptsc4, prompttc4, prompten4, promptsc5, prompttc5, " +//5 " prompten5 " +//6 " from fnafeewfinfologicreverse " + " where mainid = " + oldMainid; rs2.executeSql(sql2); sql2 = "insert into fnaFeeWfInfoLogicAdvanceR\n" + " (mainid, rule1, rule1intensity, rule2, rule2intensity, " +//1 " rule3, rule3intensity, rule4, rule4intensity, rule5, " +//2 " rule5intensity, promptsc, prompttc, prompten, promptsc2, " +//3 " prompttc2, prompten2, promptsc3, prompttc3, prompten3, " +//4 " promptsc4, prompttc4, prompten4, promptsc5, prompttc5, " +//5 " prompten5)\n" + //6 " select " + newMainid + ", rule1, rule1intensity, rule2, rule2intensity, " +//1 " rule3, rule3intensity, rule4, rule4intensity, rule5, " +//2 " rule5intensity, promptsc, prompttc, prompten, promptsc2, " +//3 " prompttc2, prompten2, promptsc3, prompttc3, prompten3, " +//4 " promptsc4, prompttc4, prompten4, promptsc5, prompttc5, " +//5 " prompten5 " +//6 " from fnaFeeWfInfoLogicAdvanceR " + " where mainid = " + oldMainid; rs2.executeSql(sql2); rs2.executeUpdate("delete from fnaFeeWfInfoMultiField where workflowId=?", newWfId); sql2 = "insert into fnaFeeWfInfoMultiField\n" + " (workflowId, dtlIdx, fieldName, fieldFnaType, fieldMemo)\n" + //1 " select " + newWfId + ", dtlIdx, fieldName, fieldFnaType, fieldMemo " +//1 " from fnaFeeWfInfoMultiField " + " where workflowId = " + oldWfId; rs2.executeUpdate(sql2); sql2 = "select nodeid, checkway " + " from fnafeewfinfonodectrl " + " where mainid = " + oldMainid; rs2.executeSql(sql2); while (rs2.next()) { int nodeid_old = Util.getIntValue(rs2.getString("nodeid"), 0); String checkway = Util.null2String(rs2.getString("checkway")).trim(); int nodeid_new = wfVer.getNodeidByWfidAndOldnodeid(newWfId, nodeid_old); if (nodeid_new > 0) { sql3 = "insert into fnafeewfinfonodectrl\n" + " (mainid, nodeid, checkway)\n" + " values " + " (" + newMainid + ", " + nodeid_new + ", '" + StringEscapeUtils.escapeSql(checkway) + "') "; rs3.executeSql(sql3); } } //移除指定workflowId缓存中的-自定义费控流程流程的字段对应关系Map对象 FnaWfSetCache.removeFnaWfFieldSetMap(newWfId); //通过读取配置信息更新缓存 FnaCommon.getFnaWfFieldInfo4Expense(newWfId, new HashMap()); } } if (need_removeCache_fnaFeeWfInfoComInfo) { new FnaFeeWfInfoComInfo().removeCache(); } } } //发票去重设置生成新版本 if (true) { //1.fnaInvoiceWfInfo //2.fnaInvoiceFeeWfInfoLogic //3.fnaInvoiceWfInfoField sql1 = "select count(*) cnt from fnaInvoiceWfInfo where workflowid = " + newWfId; rs1.executeSql(sql1); if (!rs1.next() || rs1.getInt("cnt") <= 0) { sql1 = "select * " +//3 " from fnaInvoiceWfInfo " + " where workflowid = " + oldWfId; rs1.executeSql(sql1); while (rs1.next()) { int oldMainid = rs1.getInt("id"); int enable = rs1.getInt("enable"); String lastmodifieddate = Util.null2String(rs1.getString("lastmodifieddate")).trim(); //fnaInvoiceWfInfo String sql2 = "insert into fnaInvoiceWfInfo (workflowid,enable,lastmodifieddate) values (" + newWfId + "," + enable + ",'" + StringEscapeUtils.escapeSql(lastmodifieddate) + "')"; rs2.executeSql(sql2); sql2 = "select max(id) maxid from fnaInvoiceWfInfo where workflowid = " + newWfId; rs2.executeSql(sql2); if (rs2.next()) { int newMainid = rs2.getInt("maxid"); //fnaInvoiceWfInfoField sql2 = "insert into fnaInvoiceWfInfoField\n" + " (mainid, workflowid, formid, fieldid, " +//1 " fieldname, tabindex, " +//2 " dtlnumber, isdtl) \n" + //3 " select " + newMainid + ", " + newWfId + ", formid, fieldid, " +//1 " fieldname, tabindex, " +//2 " dtlnumber, isdtl " +//3 " from fnaInvoiceWfInfoField " + " where workflowid = " + oldWfId + " " + " and mainid = " + oldMainid; rs2.executeSql(sql2); } } } } //微报账记一笔 可发起的报销流程 if (true) { if (true) {//1可发起的报销流程赋值 String workflowIds = ""; rs1.executeQuery("select workflowIds from fnaInvoiceEnterWay"); if (rs1.next()) { workflowIds = Util.null2String(rs1.getString("workflowIds")); } String[] workflowIdsSplit = workflowIds.split(","); StringBuffer workflowIdBuffer = new StringBuffer(); for (int i = 0; i < workflowIdsSplit.length; i++) { String workFlowId = workflowIdsSplit[i]; if (oldWfId == Util.getIntValue(workFlowId, 0)) { workFlowId = workFlowId + "," + newWfId; } if (workflowIdBuffer.length() != 0) { workflowIdBuffer.append(","); } workflowIdBuffer.append(workFlowId); } if (!workflowIds.equals(workflowIdBuffer.toString())) { rs1.executeUpdate("update fnaInvoiceEnterWay set workflowIds=?", workflowIdBuffer.toString()); } } if (true) {//2每个记一笔费用类型中 rs1.executeQuery("select id,workflowIds from fnaTakeOneNote"); while (rs1.next()) { String id = Util.null2String(rs1.getString("id")); String workflowIds = Util.null2String(rs1.getString("workflowIds")); String[] workflowIdsSplit = workflowIds.split(","); StringBuilder workflowIdBuffer = new StringBuilder(); for (String s : workflowIdsSplit) { String workFlowId = s; if (oldWfId == Util.getIntValue(workFlowId, 0)) { workFlowId = workFlowId + "," + newWfId; } if (workflowIdBuffer.length() != 0) { workflowIdBuffer.append(","); } workflowIdBuffer.append(workFlowId); } if (!workflowIds.equals(workflowIdBuffer.toString())) { rs2.executeUpdate("update fnaTakeOneNote set workflowIds=? where id=?", workflowIdBuffer.toString(), id); } } } if (true) {//3每个记一笔费用类型中的字段对应 String sql = "insert into fnaTakeNoteWfField(mainId,workflowId,formId,fieldId,fieldDbName,dtlNumber,isDtl)" + " select mainId," + newWfId + ",formId,fieldId,fieldDbName,dtlNumber,isDtl from fnaTakeNoteWfField where workflowId=?"; rs1.executeUpdate(sql, oldWfId); } } { RecordSet mainIdRs = new RecordSet(); RecordSet mainTableRs = new RecordSet(); RecordSet dtlTableRs = new RecordSet(); RecordSet accountIdRs = new RecordSet(); String newSubjectMainId = ""; String newPeriodMainId = ""; String newBearerMainId = ""; String oldSubjectMainId = ""; String oldBearerMainId = ""; String oldPeriodMainId = ""; List subjectAccountList = new ArrayList<>(); List periodAccountList = new ArrayList<>(); List bearerAccountList = new ArrayList<>(); // 开始复制主表 String subjectConfigInsertSql = " insert into FnaMultiAccountSubject (workflowId,fieldId,accountId,onlyEnd,isFilter,choice) " + " select " + newWfId + " ,fieldId,accountId,onlyEnd,isFilter,choice from FnaMultiAccountSubject where workflowId = ? "; String periodConfigInsertSql = " insert into FnaMultiPeriodFilter (workflowId,fieldId,accountId,onlyEnd,isFilter,choice) " + " select " + newWfId + " ,fieldId,accountId,onlyEnd,isFilter,choice from FnaMultiPeriodFilter where workflowId = ? "; String bearerConfigInsertSql = " insert into FnaMultiBearerFilter (workflowId,fieldId,accountId,onlyEnd,isFilter,choice) " + " select " + newWfId + " ,fieldId,accountId,onlyEnd,isFilter,choice from FnaMultiBearerFilter where workflowId = ? "; mainTableRs.executeUpdate(subjectConfigInsertSql, oldWfId); mainTableRs.executeUpdate(periodConfigInsertSql, oldWfId); mainTableRs.executeUpdate(bearerConfigInsertSql, oldWfId); // 根据旧的 wfID 找到对应的 accountId [账套可能是多个] String subjectAccountSql = " select accountId , fieldId from FnaMultiAccountSubject where workflowId = ? "; String periodAccountSql = " select accountId , fieldId from FnaMultiPeriodFilter where workflowId = ? "; String bearerAccountSql = " select accountId , fieldId from FnaMultiBearerFilter where workflowId = ? "; accountIdRs.executeQuery(subjectAccountSql, oldWfId); while (accountIdRs.next()) { subjectAccountList.add(Util.null2String(accountIdRs.getString("accountId")) + "_" +Util.null2String(accountIdRs.getString("fieldId"))); } accountIdRs.executeQuery(periodAccountSql, oldWfId); while (accountIdRs.next()) { periodAccountList.add(Util.null2String(accountIdRs.getString("accountId")) + "_" +Util.null2String(accountIdRs.getString("fieldId"))); } accountIdRs.executeQuery(bearerAccountSql, oldWfId); while (accountIdRs.next()) { bearerAccountList.add(Util.null2String(accountIdRs.getString("accountId")) + "_" +Util.null2String(accountIdRs.getString("fieldId"))); } // 根据旧的的 wfID 和 accountId / fieldId 找到旧的 MainId // 根据旧的 mainId 找到所对应的数据 // 把数据复制到新的 mainId // 更新 FnaMultiAccountSubjectDetail 明细表 String subjectConfigSelectSql = " select id from FnaMultiAccountSubject where workflowId = ? and accountId = ? and fieldId = ?"; for (String subjectAccountArray : subjectAccountList) { String[] split = subjectAccountArray.split("_"); mainIdRs.executeQuery(subjectConfigSelectSql, newWfId, split[0],split[1]); if (mainIdRs.next()) { newSubjectMainId = Util.null2String(mainIdRs.getString("id")); } mainIdRs.executeQuery(subjectConfigSelectSql, oldWfId, split[0],split[1]); if (mainIdRs.next()) { oldSubjectMainId = Util.null2String(mainIdRs.getString("id")); } String subjectConfigDtlInsertSql = " insert into FnaMultiAccountSubjectDetail ( mainId , subjectId , subjectCode ) " + " select " + newSubjectMainId + " , subjectId , subjectCode from FnaMultiAccountSubjectDetail where mainId = ? "; dtlTableRs.executeUpdate(subjectConfigDtlInsertSql, oldSubjectMainId ); } // 更新 FnaMultiPeriodFilterDtl 明细表 String periodConfigSelectSql = " select id from FnaMultiPeriodFilter where workflowId = ? and accountId = ? and fieldId = ?"; for (String periodAccountArray : periodAccountList) { String[] split = periodAccountArray.split("_"); mainIdRs.executeQuery(periodConfigSelectSql, newWfId, split[0],split[1]); if (mainIdRs.next()) { newPeriodMainId = Util.null2String(mainIdRs.getString("id")); } mainIdRs.executeQuery(periodConfigSelectSql, oldWfId, split[0],split[1]); if (mainIdRs.next()) { oldPeriodMainId = Util.null2String(mainIdRs.getString("id")); } String periodConfigDtlInsertSql = " insert into FnaMultiPeriodFilterDtl ( mainId , periodId , periodCode ) " + " select " + newPeriodMainId + " , periodId , periodCode from FnaMultiPeriodFilterDtl where mainId = ? "; dtlTableRs.executeUpdate(periodConfigDtlInsertSql, oldPeriodMainId); } // 更新 FnaMultiBearerFilterDetail 明细表 String bearerConfigSelectSql = " select id from FnaMultiBearerFilter where workflowId = ? and accountId = ? and fieldId = ? "; for (String bearerAccountArray : bearerAccountList) { String[] split = bearerAccountArray.split("_"); mainIdRs.executeQuery(bearerConfigSelectSql, newWfId, split[0],split[1]); if (mainIdRs.next()) { newBearerMainId = Util.null2String(mainIdRs.getString("id")); } mainIdRs.executeQuery(bearerConfigSelectSql, oldWfId, split[0],split[1]); if (mainIdRs.next()) { oldBearerMainId = Util.null2String(mainIdRs.getString("id")); } String bearerConfigDtlInsertSql = " insert into FnaMultiBearerFilterDetail ( mainId , bearerIds , bearerCode ) " + " select " + newBearerMainId + " , bearerIds , bearerCode from FnaMultiBearerFilterDetail where mainId = ? "; dtlTableRs.executeUpdate(bearerConfigDtlInsertSql, oldBearerMainId); } } FnaWorkflowSetUtils.createNewWorkflowVersion(oldWfId, newWfId, ip, user); } /** * 左侧填充字符串 */ public final static int LEFT = 0; /** * 右侧填充字符串 */ public final static int RIGHT = 1; /** * 填充字符串 * * @param srcStr * @param fillChar * @param length * @param leftOrRight 填充左侧:DooGlobalBase.LEFT;填充右侧:DooGlobalBase.RIGHT * @return */ public static String fillStr(final String srcStr, final char fillChar, final int length, final int leftOrRight) { final StringBuilder formatStr = new StringBuilder(""); for (int i = srcStr.getBytes().length; i < length; i++) { formatStr.append(fillChar); } if (leftOrRight == FnaCommon.LEFT) { return formatStr.toString() + srcStr; } else if (leftOrRight == FnaCommon.RIGHT) { return srcStr + formatStr.toString(); } return ""; } /** * 将dataArray中的数据,按900个一组(每一项之间使用英文半角逗号分隔)set到return的List中去 * * @param dataArray * @return */ public static List initData1(String[] dataArray) { List dataList = Arrays.asList(dataArray); return FnaCommon.initData1(dataList); } /** * 将dataList中的数据,按900个一组(每一项之间使用英文半角逗号分隔)set到return的List中去 * * @param dataList * @return */ public static List initData1(List dataList) { List distinct_list = new ArrayList(); ArrayList list = new ArrayList(); int dataListLen = dataList.size(); int sqlCond_Index = 0; while (sqlCond_Index < dataListLen) { StringBuffer sqlCond_ids = new StringBuffer(""); for (int i = 0; i < 900; i++) { if (sqlCond_Index == dataListLen) { break; } String key1 = dataList.get(sqlCond_Index); if (!"".equals(key1) && !distinct_list.contains(key1)) { distinct_list.add(key1); if (sqlCond_ids.length() > 0) { sqlCond_ids.append(","); } sqlCond_ids.append(key1); } sqlCond_Index++; } if (sqlCond_ids.length() > 0) { list.add(sqlCond_ids.toString()); } } return list; } /** * 获取传入人员id(userid)的相关信息(传入人员、所属部门、所属分部,关联的第一个成本中心的id和名称) * * @param dataMapHrm lastname;deptId;deptName;subcomId;subcomName;fccId;fccName; * @param userid 人员id */ public static void getHrmResourceInfo(HashMap dataMapHrm, int userid) { FnaSystemSetComInfo fnaSystemSetComInfo = new FnaSystemSetComInfo(); String fccFilterRule = Util.null2String(fnaSystemSetComInfo.get_fccFilterRule(), "");//成本中心按关联对象过滤 boolean isFilter = false;//是否需要考虑规则 //判断 成本中心按关联对象过滤 的已配置的规则 int count = FnaCostCenter.fccFilterRuleChoice.length; boolean[] aaaa = new boolean[count]; for (int i = 1; i <= count; i++) { if (("," + fccFilterRule + ",").indexOf(("," + i + ",")) > -1) { aaaa[i - 1] = true; isFilter = true; } else { aaaa[i - 1] = false; } } boolean openSub = (count >= 1 ? aaaa[0] : false); boolean openDept = (count >= 2 ? aaaa[1] : false); boolean openHrm = (count >= 3 ? aaaa[2] : false); ResourceComInfo rci = null; try { rci = new ResourceComInfo(); } catch (Exception ex) { } DepartmentComInfo dci = new DepartmentComInfo(); SubCompanyComInfo scci = new SubCompanyComInfo(); String _userid = String.valueOf(userid); String lastname = ""; String deptId = ""; String deptName = ""; String subcomId = ""; String subcomName = ""; String fccId = ""; String fccName = ""; if ("1".equals(fnaSystemSetComInfo.get_fnaBudgetOAOrg())) { lastname = rci.getLastname(_userid); deptId = rci.getDepartmentID(_userid); deptName = dci.getDepartmentname(deptId); subcomId = rci.getSubCompanyID(_userid); subcomName = scci.getSubCompanyname(subcomId); } if ("1".equals(fnaSystemSetComInfo.get_fnaBudgetCostCenter())) { RecordSet rs = new RecordSet(); String sql02 = "select a.id fccId, a.name fccName, b.type " + " from FnaCostCenter a " + " join FnaCostCenterDtl b on a.id = b.fccId " + " where (a.Archive is null or a.Archive = 0) and ((b.objId=? and b.type=1) or (b.objId=? and b.type=2) or (b.objId=? and b.type=3)) " + " order by b.type desc, a.code, a.name, a.id"; rs.executeQuery(sql02, Util.getIntValue(subcomId), Util.getIntValue(deptId), userid); while (rs.next()) { int type = Util.getIntValue(rs.getString("type")); if (type == 3 && (!isFilter || (isFilter && openHrm))) {//通过人员关联关系带出成本中心 fccId = Util.null2String(rs.getString("fccId")); fccName = Util.null2String(rs.getString("fccName")); break; } else if (type == 2 && (!isFilter || (isFilter && openDept))) {//通过人员所属部门关联关系带出成本中心 fccId = Util.null2String(rs.getString("fccId")); fccName = Util.null2String(rs.getString("fccName")); break; } else if (type == 1 && (!isFilter || (isFilter && openSub))) {//通过人员所属分部关联关系带出成本中心 fccId = Util.null2String(rs.getString("fccId")); fccName = Util.null2String(rs.getString("fccName")); break; } } } dataMapHrm.put("lastname", lastname); dataMapHrm.put("deptId", deptId); dataMapHrm.put("deptName", deptName); dataMapHrm.put("subcomId", subcomId); dataMapHrm.put("subcomName", subcomName); dataMapHrm.put("fccId", fccId); dataMapHrm.put("fccName", fccName); } /** * 判断当前 流程 是否需要进行费控校验 * * @param workflowid 流程ID * @param requestid 请求ID * @param dataMap 流程字段对应信息,可以传 null * @param isprint 是否打印日志 * @param isDB
  • true=校验数据库的值, 此时 _value_main_fieldIdSfysn 可以是任意值; *
  • false=校验页面上的值,此时 _value_main_fieldIdSfysn 应该取值于页面; * @param _value_main_fieldIdSfysn 真值 * @return boolean true=需要费控校验; false=不需要费控校验 */ @Deprecated public static boolean isNeedControl( int workflowid, int requestid, Map dataMap, boolean isprint, boolean isDB, int _value_main_fieldIdSfysn) { boolean isControl = true;//默认需要费控 int condition = FnaCommon.isNeedControl_New(workflowid, requestid, dataMap, isprint, isDB, _value_main_fieldIdSfysn); if (condition == 0 || condition == 2) {//0=预算外;2=预算内,且不做任何校验; isControl = false; } else if (condition == 1) {//1=预算内,且按照标准的费控逻辑进行判断; isControl = true; } return isControl; } /** * 判断当前 流程 所属的费控情况是什么 * * @param workflowid 流程ID * @param requestid 请求ID * @param dataMap 流程字段对应信息,可以传 null * @param isprint 是否打印日志 * @param isDB
  • true=校验数据库的值, 此时 _value_main_fieldIdSfysn 可以是任意值; *
  • false=校验页面上的值,此时 _value_main_fieldIdSfysn 应该取值于页面; * @param _value_main_fieldIdSfysn 真值 * @return int 情况含义: *
  • 0=预算外; *
  • 1=预算内,且按照标准的费控逻辑进行判断; *
  • 2=预算内,且不做任何校验; */ public static int isNeedControl_New( int workflowid, int requestid, Map dataMap, boolean isprint, boolean isDB, int _value_main_fieldIdSfysn) { int isControl = 1;//默认需要费控 RecordSet rs = new RecordSet(); boolean result = false;//sql 语句执行是否成功 String sql = ""; int formid = -100; BaseBean bb = new BaseBean(); if (!isDB && _value_main_fieldIdSfysn < 0) {//校验页面上的值 且 页面没有选择值 isControl = 1; return isControl; } if (dataMap == null) { dataMap = new HashMap(); FnaCommon.getFnaWfFieldInfo4Expense(workflowid, dataMap); } if (requestid <= 0) {//是新建的流程 isDB = false; } try { //(1)下拉框字段filedName String filedname = Util.null2s(dataMap.get("main_fieldIdSfysn_fieldName"), ""); if ("".equals(filedname)) { isControl = 1;//流程没有费控配置信息,则默认需要费控 return isControl; } else { //(2)需要费控 的真值 List selectvalueList = new ArrayList(); selectvalueList.add("");//不填默认也是需要费控 selectvalueList.add("-100");//不填默认也是需要费控 selectvalueList.add("1");// 1=是=预算内 //(3)判断当前流程是否需要费控 if (isDB) {//是数据库的值,则校验数据库的 String formValue = "";//字段在表单中的值 //(3-1)获取流程表单中的下拉框字段的值 sql = "select * from workflow_base where id = " + workflowid; result = rs.executeQuery(sql); if (!result) { isControl = 1; return isControl; } else { if (rs.next()) { formid = Math.abs(Util.getIntValue(rs.getString("formid"))); } } String maintable = "formtable_main_" + formid;//当前流程主表英文名称 sql = " select a." + filedname + " as filedValue from " + maintable + " a where a.requestid=" + requestid; if (isprint) { bb.writeLog("FnaCommon.java 4700 sql=" + sql); } result = rs.executeQuery(sql); if (!result) { isControl = 1; return isControl; } else { if (rs.next()) { formValue = Util.null2String(rs.getString("filedValue"), "").trim(); } } //(3-1)判断表单中的值 是否 是需要费控的值, 是则需要费控;否则不需要费控 if (selectvalueList.contains(formValue)) { isControl = 1; } else { int ssss = Util.getIntValue(formValue, 1); if (0 <= ssss && ssss <= 2) { isControl = ssss; } else { isControl = 1; } } } else {//是页面上的值,则校验页面的 //(3-2)判断表单中的值 是否 是需要费控的值, 是则需要费控;否则不需要费控 if (selectvalueList.contains(String.valueOf(_value_main_fieldIdSfysn))) { isControl = 1; } else { int ssss = _value_main_fieldIdSfysn; if (0 <= ssss && ssss <= 2) { isControl = ssss; } else { isControl = 1; } } } } } catch (Exception e) { return isControl; } return isControl; } /** * 校验承担主体ID是否存在 * * @param rs2 * @param organizationtype * @param organizationid */ public static String checkCdzt(RecordSet rs2, int organizationtype, int organizationid) { String result = ""; //802939 承担主体会消失,需要校验是否存在 String sql = ""; String orgTypeName = ""; if (organizationtype == 1) { sql = " select a.id, a.subcompanyname name from HrmSubCompany a where a.id = ? "; orgTypeName = SystemEnv.getHtmlLabelName(141, 7); } else if (organizationtype == 2) { sql = " select a.id, a.departmentname name from HrmDepartment a where a.id = ? "; orgTypeName = SystemEnv.getHtmlLabelName(124, 7); } else if (organizationtype == 3) { sql = " select a.id, a.lastname name from HrmResource a where a.id = ? "; orgTypeName = SystemEnv.getHtmlLabelName(6087, 7); } else if (organizationtype == FnaCostCenter.ORGANIZATION_TYPE) { sql = " select a.id, a.name name from FnaCostCenter a where a.id = ? "; orgTypeName = SystemEnv.getHtmlLabelName(515, 7); } rs2.executeQuery(sql, organizationid); if (rs2.next()) { } else { result = "" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10003246, weaver.general.ThreadVarLanguage.getLang()) + "" + orgTypeName + "ID : " + organizationid + " " + weaver.systeminfo.SystemEnv.getHtmlLabelName(24233, weaver.general.ThreadVarLanguage.getLang()) + "OA" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10003247, weaver.general.ThreadVarLanguage.getLang()) + ""; } return result; } }