ecology_maven/weaver/fna/general/FnaCommon.java

5921 lines
312 KiB
Java
Raw Normal View History

2021-11-14 15:29:16 +08:00
/*
*
* 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<String, String> _isEnableFnaWfHm = new HashMap<String, String>();
if (otherPara_hs.containsKey(_key01)) {
_isEnableFnaWfHm = (HashMap<String, String>) 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<String, String> fnaWfSetMap = null;
if (otherPara_hs.containsKey(_key001)) {
fnaWfSetMap = (HashMap<String, String>) otherPara_hs.get(_key001);
} else {
fnaWfSetMap = new HashMap<String, String>();
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<String, HashMap<String, String>> 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<String, HashMap<String, String>> 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<String, HashMap<String, String>> 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<String, HashMap<String, String>> 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 oraclesqlServer
* @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<String, String> 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()) + "";
/**
* <br>
* BudgetAutoMoveAfterOccurDate1 = "流程表单上填写的费用日期";<br>
* BudgetAutoMoveAfterOccurDate3 = "流程费用表中保存的费用日期";<br>
* BudgetAutoMoveAfterOccurDate4 = "流程费用表中保存的结转前的费用日期";<br>
* IsBudgetAutoMove = "流程费用表记录是否发生过结转1结转过其他没有结转过";
*
* @param occurdate
* @param dtl_id PkId
* @param requestid requestid
* @param fnaExpenseInfoRecordHm
* @return
*/
public static HashMap<String, String> getBudgetAutoMoveAfterOccurDate(String occurdate, int dtl_id, int requestid,
HashMap<String, String> fnaExpenseInfoRecordHm) {
return getBudgetAutoMoveAfterOccurDate(occurdate, "", dtl_id, requestid, fnaExpenseInfoRecordHm);
}
/**
* <br>
* BudgetAutoMoveAfterOccurDate1 = "流程表单上填写的费用日期";<br>
* BudgetAutoMoveAfterOccurDate3 = "流程费用表中保存的费用日期";<br>
* BudgetAutoMoveAfterOccurDate4 = "流程费用表中保存的结转前的费用日期";<br>
* IsBudgetAutoMove = "流程费用表记录是否发生过结转1结转过其他没有结转过";
*
* @param occurdate
* @param detailtable dtl_id
* @param dtl_id PkId
* @param requestid requestid
* @param fnaExpenseInfoRecordHm
* @return
*/
public static HashMap<String, String> getBudgetAutoMoveAfterOccurDate(String occurdate, String detailtable, int dtl_id, int requestid,
HashMap<String, String> fnaExpenseInfoRecordHm) {
HashMap<String, String> retHm = new HashMap<String, String>();
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<String> list_out_FnaExpenseInfo = new ArrayList<String>();
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<String> allowOrgIdEdit_list = new ArrayList<String>();
boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowSubCmpIdEdit(userId, allowOrgIdEdit_list);
if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) {
fnaBudgetViewFlag = true;
}
} else if ("2".equals(organizationtype)) {
List<String> allowOrgIdEdit_list = new ArrayList<String>();
boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowDepIdEdit(userId, allowOrgIdEdit_list);
if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) {
fnaBudgetViewFlag = true;
}
} else if ("3".equals(organizationtype)) {
List<String> grList = new ArrayList<String>();
grList.add(organizationid);
List<String> allowOrgIdEdit_list = new ArrayList<String>();
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<String> allowOrgIdEdit_list = new ArrayList<String>();
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<String> allowOrgIdEdit_list = new ArrayList<String>();
boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowSubCmpId(userId, allowOrgIdEdit_list);
if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) {
fnaBudgetViewFlag = true;
}
} else if ("2".equals(organizationtype)) {
List<String> allowOrgIdEdit_list = new ArrayList<String>();
boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowDepId(userId, allowOrgIdEdit_list);
if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) {
fnaBudgetViewFlag = true;
}
} else if ("3".equals(organizationtype)) {
List<String> grList = new ArrayList<String>();
grList.add(organizationid);
List<String> allowOrgIdEdit_list = new ArrayList<String>();
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<String> allowOrgIdEdit_list = new ArrayList<String>();
boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowFccId(userId, allowOrgIdEdit_list);
if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) {
fnaBudgetViewFlag = true;
}
}
return fnaBudgetViewFlag;
}
/**
* UTF-83
*
* @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;
}
}
/**
* oracleclobsqlservertext
*
* @param tableName
* @param clobFieldName clobtext
* @param colbFieldValue clobtext
* @param keyFieldName
* @param keyFieldValue
* @param keyFieldDbType intstring
* @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.updateDbClobTextFieldValuekeyFieldDbType 记录主键字段数据库字段类型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<String[]> copyList_stringArray(List<String[]> list1) {
List<String[]> list2 = new ArrayList<String[]>();
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<String> copyList_string(List<String> list1) {
List<String> list2 = new ArrayList<String>();
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<String> list1, List<String> list2) {
//List<String> list2 = new ArrayList<String>();
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.jsdoFnaEncryptRsa1()
*
* @param str /fna/js/e8Common_wev8.jsdoFnaEncryptRsa1()
* @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<String> budgetid_list = new ArrayList<String>();
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);
}
}
}
}
}
/**
* ()<br>
* 145257 action<br>
* 1<br>
* e7e8<br>
* 2<br>
* 1e7<br>
* 2e8<br>
* action.FnaBorrowEffectNew<br>
* action.fnaBorrowReverseNew<br>
* <br>
* action.fnaBorrowReverseNew<br>
* action.WorkflowFnaInWorkflowNew<br>
* action.WorkflowFnaEffectNew<br>
* action.FnaChangeEffectNew<br>
* action.FnaShareEffectNew<br>
*
*
* @param requestid requestid
* @param wfForceOverLogic 01
* @param forceDelete truewfForceOverLogic
*/
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");
//配置了生成借款的actionFnaAdvanceEffectNew
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");
//配置了生成借款的actionFnaBorrowEffectNew
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");
//配置了冲销借款的actionFnaBorrowReverseNew
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");
//配置了冲销借款的actionfnaBorrowReverseNew
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");
//配置了冻结预算的actionworkflowFnaInWorkflowNew
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");
//配置了扣除预算的actionWorkflowFnaEffectNew
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");
//配置了冲销预付款的actionFnaAdvanceReverseNew
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<String> list_out_FnaExpenseInfo = new ArrayList<String>();
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 = "<img src='/images/BacoError_wev8.gif' align='absMiddle' />";
}
String spanStr = "<span id='field" + fieldid + "_" + derecorderindex + "span' style='" + finCss + "'>" + spanValue + "</span>";
String inputStr = spanStr + "<div class='e8_innerShow e8_innerShow_button' " +
" style='max-height:2200px;'>" +
"<span class='e8_spanFloat'>" +
"<span class='e8_browserSpan'>" +
"<button class='e8_browflow' type='button' " +
" id='field" + fieldid + "_" + derecorderindex + "_browserbtnfna' " +
" onclick='onShowBrowser_fnaBorrowRequestDtl(this);'></button>" +
"</span>" +
"</span>" +
"</div>";
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 = "<img src='/images/BacoError_wev8.gif' align='absMiddle' />";
}
String spanStr = "<span id='field" + fieldid + "_" + derecorderindex + "span' style='" + finCss + "'>" + spanValue + "</span>";
String inputStr = spanStr + "<div class='e8_innerShow e8_innerShow_button' " +
" style='max-height:2200px;'>" +
"<span class='e8_spanFloat'>" +
"<span class='e8_browserSpan'>" +
"<button class='e8_browflow' type='button' " +
" id='field" + fieldid + "_" + derecorderindex + "_browserbtnfna' " +
" onclick='onShowBrowser_fnaAdvanceRequestDtl(this);'></button>" +
"</span>" +
"</span>" +
"</div>";
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 = "<input id='btnTzmx_field" + fieldid + "_" + derecorderindex + "' type='button' " +
" value='" + SystemEnv.getHtmlLabelName(83211, languageId) + "' " +//查看金额修改历史
" onclick='showAmountOfHistory_onclick(this);' " +
" _detailRecordId='" + detailRecordId + "' " +
" class='e8_btn_top' style='margin-left:5px;' />";
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 = "<input id='btnTzmx_field" + fieldid + "_" + derecorderindex + "' type='button' " +
" value='" + SystemEnv.getHtmlLabelName(83211, languageId) + "' " +//查看金额修改历史
" onclick='showAmountOfHistory_onclick(this);' " +
" _detailRecordId='" + detailRecordId + "' " +
" class='e8_btn_top' style='margin-left:5px;' />";
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 = "<input id='btnXghklc_field" + fieldid + "_" + derecorderindex + "' type='button' " +
" value='" + SystemEnv.getHtmlLabelName(367, languageId) + "' " +//查看
" onclick='showRelatedProcess_onclick(this);' " +
" _detailRecordId='" + detailRecordId + "' " +
" class='e8_btn_top' style='margin-left:5px;' />";
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 keyisEnableFnaRepaymentWfvaluetruefalse<br>
* idkeyformIdvalueid<br>
* keyisbillvalue01
*/
public static HashMap<String, String> getIsEnableFnaRepaymentWfHm(int _workflowid) {
BaseBean _bb = new BaseBean();
RecordSet rs_fna = new RecordSet();
HashMap<String, String> retHm = new HashMap<String, String>();
//是否是系统表单的费控流程
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 keyisEnableFnaBorrowWfvaluetruefalse<br>
* idkeyformIdvalueid<br>
* keyisbillvalue01
*/
public static HashMap<String, String> getIsEnableFnaBorrowWfHm(int _workflowid) {
BaseBean _bb = new BaseBean();
RecordSet rs_fna = new RecordSet();
HashMap<String, String> retHm = new HashMap<String, String>();
//是否是系统表单的费控流程
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;
}
/**
* in999sql
*
* @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<String, String> fnaWfSetMap, HashMap<String, HashMap<String, String>> reqDataMap,
int languageId,
Hashtable otherPara_hs, HashMap<String, String> 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<String, String> fnaWfSetMap, HashMap<String, HashMap<String, String>> reqDataMap, Hashtable otherPara_hs,
int language, ResourceComInfo rci, DepartmentComInfo dci, SubCompanyComInfo scci, HashMap<String, HashMap<String, String>> 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<String, String> otherReturnVal = new HashMap<String, String>();
int newBtnType = FnaCommon.getOrgBtnTypeByFnaFieldType(_detailFieldId, oldBtnType, detailRecordKey, requestid,
fnaWfSetMap, reqDataMap,
language,
otherPara_hs, otherReturnVal);
HashMap<String, String> 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<String, String> 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<String, String> fnaWfSetMap, HashMap<String, HashMap<String, String>> 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<String, String> otherReturnVal = new HashMap<String, String>();
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<String, String> fnaWfSetMap, HashMap<String, HashMap<String, String>> reqDataMap,
int languageId,
Hashtable otherPara_hs, HashMap<String, String> 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<String, String> 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<String, String>) 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<String, String>();
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<String, String> dataMapHrm = new HashMap<String, String>();
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<String, String> fnaWfSetMap, HashMap<String, HashMap<String, String>> reqDataMap, HashMap<String, HashMap<String, String>> 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<String, String> 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<String, String> 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 + "<br>" +
"<font color=red>" + SystemEnv.getHtmlLabelName(18503, languageId) + ":" + values1 + "</font><br>" +
"<font color=green>" + SystemEnv.getHtmlLabelName(18769, languageId) + ":" + values2 + "</font>";
if (!"".equals(budgetAutoMoveInfo)) {
tempmsg += "<br>" + 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<String, String> 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();
}
/**
* getSqlByFnaFieldTypesqlrequestid
*
* @param _requestId requestid
* @param _formId id
* @param dataMap hm
* @param _isEnableFnaWfE8 Ecology8
* @param _isEnableFnaChangeWf Ecology8
* @param _isEnableFnaShareWf Ecology8
* @return
*/
public static HashMap<String, HashMap<String, String>> qryFnaExpenseRequestRecord(int _requestId, int _formId, Map<String, String> dataMap,
boolean _isEnableFnaWfE8, boolean _isEnableFnaChangeWf, boolean _isEnableFnaShareWf) {
RecordSet rs_fna = new RecordSet();
HashMap<String, HashMap<String, String>> retHm = new HashMap<String, HashMap<String, String>>();
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<String, String> hm = new HashMap<String, String>();
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<sourceRequestidDtlId, HashMap < , >>
*/
public static HashMap<String, HashMap<String, String>> qryFnaExpenseInfoAllRowRecordHm(int _requestId) {
RecordSet rs_fna = new RecordSet();
HashMap<String, HashMap<String, String>> retHm = new HashMap<String, HashMap<String, String>>();
//定位 数据库表名, 日期范围可能跨年
List<String> list_out_FnaExpenseInfo = new ArrayList<String>();
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<String, String> hm = new HashMap<String, String>();
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<String, HashMap<String, String>> qryFnaRepaymentRequestRecord(int requestid, int _formId, Map<String, String> dataMap) {
RecordSet rs_fna = new RecordSet();
HashMap<String, HashMap<String, String>> retHm = new HashMap<String, HashMap<String, String>>();
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<String, HashMap<String, String>> jklcsHm = new HashMap<String, HashMap<String, String>>();
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<String, String> hm = new HashMap<String, String>();
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<String, String> _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<String, String> hm = new HashMap<String, String>();
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<String, HashMap<String, String>> qryFnaReverseAdvanceRequestRecord(int requestid, int _formId, Map<String, String> dataMap) {
RecordSet rs_fna = new RecordSet();
HashMap<String, HashMap<String, String>> retHm = new HashMap<String, HashMap<String, String>>();
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<String, HashMap<String, String>> YfklcsHm = new HashMap<String, HashMap<String, String>>();
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<String, String> hm = new HashMap<String, String>();
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<String, String> _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<String, String> hm = new HashMap<String, String>();
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<String, HashMap<String, String>> 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<String, HashMap<String, String>> jklcsHm) {
RecordSet rs_fna = new RecordSet();
String spanValue = "";
if (jklc > 0 && dhxh > 0) {
boolean _flag1 = false;
HashMap<String, String> _jklcDtlIdxHm = null;
if (jklcsHm != null) {
if (jklcsHm.containsKey(jklc + "")) {
_jklcDtlIdxHm = jklcsHm.get(jklc + "");
_flag1 = true;
} else {
_jklcDtlIdxHm = new HashMap<String, String>();
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<String, FnaWfMultiSetFieldInfo> fieldInfoHm = fnaWfMultiSet.getFieldInfoHm();
List<String> 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 keyisEnableFnaWfSysWfvaluetruefalse<br>
* Ecology7keyisEnableFnaWfE7valuetruefalse<br>
* Ecology8keyisEnableFnaWfE8valuetruefalse<br>
* idkeyformIdvalueid<br>
* keyisbillvalue01
*/
public static HashMap<String, String> getIsEnableFnaWfHm(int _workflowid) {
BaseBean _bb = new BaseBean();
RecordSet rs_fna = new RecordSet();
HashMap<String, String> retHm = new HashMap<String, String>();
//是否是系统表单的费控流程
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 MQHY
* @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);
}
/**
* sessionList
*
* @param tabFeeperiod MQHY
* @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<br>
* strtrim
*
* @param str
* @return
*/
public static String escapeHtmlTrim(String str) {
return FnaCommon.escapeHtml(Util.null2String(str).trim());
}
/**
* & " ' < > html<br>
* 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("\\&", "&amp;")
.replaceAll("\"", "&quot;")
.replaceAll("\'", "&apos;")
.replaceAll("\\<", "&lt;")
.replaceAll("\\>", "&gt;")
;
}
/**
* & " ' < > xml
*
* @param str
* @return
*/
public static String escapeXml(String str) {
if (str == null || "".equals(str)) {
return str;
}
return str
.replaceAll("\\&", "&amp;")
.replaceAll("\"", "&quot;")
.replaceAll("\'", "&apos;")
.replaceAll("\\<", "&lt;")
.replaceAll("\\>", "&gt;")
;
}
/**
* 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", "%")
;
}
/**
* urlurl
*
* @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<HashMap<String, String>> 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<HashMap<String, String>> fieldList, String detailtable) {
int fieldListLen = fieldList.size();
for (int i = 0; i < fieldListLen; i++) {
HashMap<String, String> fieldHm = (HashMap<String, String>) 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<HashMap < String, String>> list
*/
public static List<HashMap<String, String>> getWfFieldFormInfoByNodeId(int nodeid) {
RecordSet rs = new RecordSet();
RecordSet rs1 = new RecordSet();
List<HashMap<String, String>> fieldList = new ArrayList<HashMap<String, String>>();
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<String, String> fieldHm = new HashMap<String, String>();
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<String> paraList = new ArrayList<String>();
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<String> newFnavoucherxmlcontentid_list = new ArrayList<String>();
List<String> oldContentparentid_list = new ArrayList<String>();
HashMap<String, String> fnavoucherxmlcontentid_hm = new HashMap<String, String>();
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<String, String>());
}
}
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<String> subjectAccountList = new ArrayList<>();
List<String> periodAccountList = new ArrayList<>();
List<String> 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.LEFTDooGlobalBase.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 "";
}
/**
* dataArray900使setreturnList
*
* @param dataArray
* @return
*/
public static List<String> initData1(String[] dataArray) {
List<String> dataList = Arrays.asList(dataArray);
return FnaCommon.initData1(dataList);
}
/**
* dataList900使setreturnList
*
* @param dataList
* @return
*/
public static List<String> initData1(List<String> dataList) {
List<String> distinct_list = new ArrayList<String>();
ArrayList<String> list = new ArrayList<String>();
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;
}
/**
* iduseridid
*
* @param dataMapHrm lastname;deptId;deptName;subcomId;subcomName;fccId;fccName;
* @param userid id
*/
public static void getHrmResourceInfo(HashMap<String, String> 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 <li>true=, _value_main_fieldIdSfysn ;
* <li>false=, _value_main_fieldIdSfysn ;
* @param _value_main_fieldIdSfysn
* @return boolean true=; false=
*/
@Deprecated
public static boolean isNeedControl(
int workflowid,
int requestid,
Map<String, String> 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 <li>true=, _value_main_fieldIdSfysn ;
* <li>false=, _value_main_fieldIdSfysn ;
* @param _value_main_fieldIdSfysn
* @return int :
* <li>0=;
* <li>1=,;
* <li>2=,;
*/
public static int isNeedControl_New(
int workflowid,
int requestid,
Map<String, String> 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<String, String>();
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<String> selectvalueList = new ArrayList<String>();
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;
}
}