日志表

dev-chenwnj
chenwei 1 year ago
parent 3836779156
commit 6271e9c86c

@ -0,0 +1,975 @@
package com.api.browser.service.impl;
import com.alibaba.fastjson.JSON;
import com.api.browser.bean.SearchConditionItem;
import com.api.browser.bean.SearchConditionOption;
import com.api.browser.bean.SplitTableBean;
import com.api.browser.bean.SplitTableColBean;
import com.api.browser.service.BrowserService;
import com.api.browser.util.*;
import com.api.workflow.util.ServiceUtil;
import com.cloudstore.dev.api.bean.SplitMobileDataBean;
import com.engine.hrm.biz.HrmClassifiedProtectionBiz;
import com.engine.workflow.biz.RequestQuickSearchBiz;
import com.engine.workflow.biz.requestForm.RequestSecLevelBiz;
import weaver.conn.RecordSet;
import weaver.crm.Maint.CustomerInfoComInfo;
import weaver.fna.budget.FnaTableNameEnum;
import weaver.fna.general.FnaCommon;
import weaver.fna.maintenance.FnaSplitTableByYearComInfo;
import weaver.fullsearch.util.SearchBrowserUtils;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.resource.ResourceComInfo;
import weaver.systeminfo.SystemEnv;
import weaver.systeminfo.setting.HrmUserSettingComInfo;
import weaver.workflow.request.RequestBaseUtil;
import weaver.workflow.workflow.WorkflowAllComInfo;
import weaver.workflow.workflow.WorkflowComInfo;
import weaver.workflow.workflow.WorkflowVersion;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.*;
import java.util.regex.Pattern;
/**
*
*
* @author jhy Mar 29, 2017
*/
public class RequestBrowserService extends BrowserService {
public static final Pattern COLLECTION_REQUEST_ID_PATTERN = Pattern.compile("requestid=(\\d+)");
public static final String SEC_LEVEL = "secretLevel";
public static final String JSON_CONFIG = "[" +
" {" +
" \"configs\": [" +
" {" +
" \"configs\": [" +
" {" +
" \"key\": \"requestname\"" +
" }" +
" ]," +
" \"key\": \"col1_row1\"" +
" }," +
" {" +
" \"configs\": [" +
" {" +
" \"key\": \"createdate\"" +
" }," +
" {" +
" \"style\": {" +
" \"float\": \"right\"" +
" }," +
" \"key\": \"creater\"" +
" }" +
" ]," +
" \"key\": \"col1_row2\"" +
" }" +
" ]," +
" \"key\": \"col1\"" +
" }" +
"]";
public static final String JSON_CONFIG_2 = "[" +
" {" +
" \"configs\": [" +
" {" +
" \"configs\": [" +
" {" +
" \"key\": \"requestnamenew\"" +
" }" +
" ]," +
" \"key\": \"col1_row1\"" +
" }," +
" {" +
" \"configs\": [" +
" {" +
" \"key\": \"createdate\"" +
" }," +
" {" +
" \"style\": {" +
" \"float\": \"right\"" +
" }," +
" \"key\": \"creater\"" +
" }" +
" ]," +
" \"key\": \"col1_row2\"" +
" }" +
" ]," +
" \"key\": \"col1\"" +
" }" +
"]";
@Override
public Map <String, Object> getBrowserData(Map <String, Object> params) throws Exception {
//判断是否走微搜接口
String fnaSqlWhere = fnaUtils(params);
boolean isQuickSearch = validQuickSearch(params);
if (isQuickSearch && "".equals(fnaSqlWhere)) {
//数据处理
if ("171".equals(browserType)) params.put("currentnodetype", 3);
eSearchParamsTrans(params);//处理传入微搜的参数
return new RequestQuickSearchBiz().getRequestList(params, user);
}
Map <String, Object> apidatas = new HashMap <String, Object>();
String backfields = " t.* ";
String orderby = "createdate , createtime ";
String importWfBrow = Util.null2String(params.get("importWfBrow"));
String fromsql = getFromSql(params,fnaSqlWhere);
int isFormEMShare = Util.getIntValue(Util.null2String(params.get("isFormEMShare")), -1);
if (isFormEMShare == 1){
getTableString4EMShare(apidatas, user, backfields, fromsql, orderby);
} else {
getTableString(apidatas, user, backfields, fromsql, orderby, importWfBrow, Util.getIntValue(Util.null2String(params.get("ismobile"))));
}
return apidatas;
}
/**
*
*
* @param params
* @return
*/
private String fnaUtils(Map <String, Object> params) {
/* begin处理还款流程请求浏览按钮过滤逻辑代码 */
String currworkflowid = Util.null2String(params.get("currworkflowid"));
if ("".equals(currworkflowid)) {
currworkflowid = Util.null2String(params.get("workflowid"));
}
String sqlwhere = "";
RecordSet rs = new RecordSet();
String fieldid = Util.null2String(params.get("fieldid"));
if (!"".equals(fieldid)) {
String newwfs[] = fieldid.split("_");
fieldid = newwfs[0];
}
int _bdf_wfid = Util.getIntValue(Util.null2String(params.get("wfid")));
int _bdf_fieldid = Util.getIntValue(Util.null2String(params.get("fieldid")));
int __requestid = Util.getIntValue(Util.null2String(params.get("__requestid")));
int _fna_wfid = Util.getIntValue(Util.null2String(params.get("fna_wfid")));
int _fna_fieldid = Util.getIntValue(Util.null2String(params.get("fna_fieldid")));
if (_bdf_wfid > 0 && _fna_wfid <= 0) {
_fna_wfid = _bdf_wfid;
}
if (Util.getIntValue(currworkflowid) > 0 && _fna_wfid <= 0) {
_fna_wfid = Util.getIntValue(currworkflowid);
}
if (_bdf_fieldid > 0 && _fna_fieldid <= 0) {
_fna_fieldid = _bdf_fieldid;
}
if (Util.getIntValue(fieldid) > 0 && _fna_fieldid <= 0) {
_fna_fieldid = Util.getIntValue(fieldid);
}
boolean _isEnableFnaWf = false;// 是否是启用的Ecology8费控流程
HashMap <String, String> _isEnableFnaWfHm = FnaCommon.getIsEnableFnaWfHm(_fna_wfid);
_isEnableFnaWf = "true".equals(_isEnableFnaWfHm.get("isEnableFnaWfE8"));
int _formId = Util.getIntValue(_isEnableFnaWfHm.get("formId"), 0);
int _isbill = Util.getIntValue(_isEnableFnaWfHm.get("isbill"), -1);
if (!_isEnableFnaWf) {
HashMap <String, String> _isEnableFnaRepaymentWfHm = FnaCommon.getIsEnableFnaRepaymentWfHm(_fna_wfid);
_isEnableFnaWf = "true".equals(_isEnableFnaRepaymentWfHm.get("isEnableFnaRepaymentWf"));
_formId = Util.getIntValue(_isEnableFnaRepaymentWfHm.get("formId"), 0);
_isbill = Util.getIntValue(_isEnableFnaRepaymentWfHm.get("isbill"), -1);
}
boolean isFnaWfFysqlcReq = false;// 是否是报销流程的费用申请流程
boolean isFnaWfRepaymentBorrowReq = false;// 是否是还款流程的冲销明细的借款流程浏览按钮
boolean isFnaWfAdvanceRepaymentAdvanceReq = false;// 是否是还款流程的冲销预付款明细的预付款流程浏览按钮
if (_isEnableFnaWf) {
isFnaWfFysqlcReq = FnaCommon.checkFnaWfFieldFnaType(_fna_wfid, _fna_fieldid, 2, 0, "fnaFeeWf");
isFnaWfRepaymentBorrowReq = (FnaCommon.checkFnaWfFieldFnaType(_fna_wfid, _fna_fieldid, 1, 2, "repayment") || FnaCommon.checkFnaWfFieldFnaType(_fna_wfid, _fna_fieldid, 1, 2, "fnaFeeWf"));
isFnaWfAdvanceRepaymentAdvanceReq = FnaCommon.checkFnaWfFieldFnaType(_fna_wfid, _fna_fieldid, 1, 4, "fnaFeeWf");
}
int borrowType = Util.getIntValue(Util.null2String(params.get("borrowType")), -1);
int ___main_fieldIdSqr_controlBorrowingWf = 0;
int ___main_fieldIdSqr_val = 0;
if (isFnaWfFysqlcReq) {
//财务报销流程相关的workflowid
String workflowidStr = "";
rs.executeQuery(" select workflowid from fnaFeeWfInfo where enable = 1 and fnaWfType = 'fnaFeeWf' ");
while(rs.next()){
String fnaworkflowId = Util.null2String(rs.getString("workflowid"));
if(!"".equals(workflowidStr)){
workflowidStr += ",";
}
workflowidStr += fnaworkflowId;
}
String fnaWfId = WorkflowVersion.getAllVersionStringByWFIDs(workflowidStr);
if("".equals(fnaWfId)){
fnaWfId = "-1";
}
String sqlIsNull = "ISNULL";
String sqlSubString = "SUBSTRING";
if ("oracle".equals(rs.getDBType())) {
sqlIsNull = "NVL";
sqlSubString = "SUBSTR";
}
else if ("mysql".equals(rs.getDBType())) {
sqlIsNull = "IFNULL";
}else if ("postgresql".equals(rs.getDBType())) {
sqlIsNull = "isnull";
}
//拼接多张费用表 start
sqlwhere += " and ( ";
//定位 数据库表名, 日期范围可能跨年
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);
if(aaaaaaaa > 0){
sqlwhere += " or ";//多张表使用 or
}
sqlwhere += " exists ( " + " select 1 " + " from "+tableName_FnaExpenseInfo+" fei " + " where fei.budgetperiodslist is not null " + " and fei.sourceRequestid <> " + __requestid + " "
+ " and fei.status = 0 " + " and fei.requestid = workflow_requestbase.requestid "
+ " GROUP BY fei.organizationid, fei.organizationtype, fei.subject, fei.budgetperiods, fei.budgetperiodslist " + " HAVING SUM(" + sqlIsNull + "(fei.amount, 0.00)) > 0.00 "
+ " ) ";
}//for end
sqlwhere += " ) ";
//拼接多张费用表 end
sqlwhere += " and workflow_requestbase.currentnodetype = 3 ";
sqlwhere += " and workflow_requestbase.workflowid in ("+fnaWfId+") ";
} else if (isFnaWfRepaymentBorrowReq) {
//需要控制只能选择自己的个人借款流程和自己发起的公务借款流程进行冲账,不能冲销其他个人借款的流程,公务借款流程可以给有权限的人员、或者自己提交的公务借款进行选择冲销。
int controlBorrowingWf_userId = user.getUID();
___main_fieldIdSqr_controlBorrowingWf = Util.getIntValue(Util.null2String(params.get("main_fieldIdSqr_controlBorrowingWf")), -1);
if (___main_fieldIdSqr_controlBorrowingWf == 1) {
___main_fieldIdSqr_val = Util.getIntValue(Util.null2String(params.get("main_fieldIdSqr_val")), -1);
controlBorrowingWf_userId = ___main_fieldIdSqr_val;
}
String _condBorrowType = "";
if (borrowType == -1 || borrowType == 0) {
_condBorrowType += " (fbi1.borrowType0 = 0 and fbi1.applicantid = " + controlBorrowingWf_userId + ") \n";
}
if (borrowType == -1) {
_condBorrowType += " or \n";
}
if (borrowType == -1 || borrowType == 1) {
_condBorrowType += " (fbi1.borrowType1 = 1) \n";
}
sqlwhere += " and exists ( \n" +
" select 1 from ( \n" +
" select fbi.borrowRequestId, fbi.borrowRequestIdDtlId, \n" +
" SUM(fbi.amountBorrow * fbi.borrowDirection) sum_amountBorrow, \n" +
" MAX(CASE WHEN fbi.recordType = 'borrow' THEN fbi.applicantid ELSE 0 END) applicantid, \n" +
" MAX(CASE WHEN fbi.recordType = 'borrow' THEN fbi.departmentid ELSE 0 END) departmentid, \n" +
" MAX(CASE WHEN fbi.recordType = 'borrow' THEN fbi.subcompanyid1 ELSE 0 END) subcompanyid1, \n" +
" MAX(CASE WHEN (fbi.borrowType is null or fbi.borrowType <> 1) THEN 0 ELSE -99999 END) borrowType0, \n" +
" MAX(CASE WHEN fbi.borrowType = 1 THEN 1 ELSE -99999 END) borrowType1 \n" +
" from FnaBorrowInfo fbi \n" +
" where fbi.requestid <> " + __requestid + " \n" +
" GROUP BY fbi.borrowRequestId, fbi.borrowRequestIdDtlId \n" +
" ) fbi1 \n" +
" where fbi1.sum_amountBorrow > 0 \n" +
" and fbi1.borrowRequestId = workflow_requestbase.requestId \n" +
" and (" + _condBorrowType + ") \n" +
" ) \n";
} else if (isFnaWfAdvanceRepaymentAdvanceReq) {
// 需要控制只能选择自己的个人借款流程和自己发起的公务借款流程进行冲账,不能冲销其他个人借款的流程,公务借款流程可以给有权限的人员、或者自己提交的公务借款进行选择冲销。
sqlwhere += " and exists ( \n" + " select 1 from ( \n" + " select fbi.advanceRequestId, fbi.advanceRequestIdDtlId, \n"
+ " SUM(fbi.amountAdvance * fbi.advanceDirection) sum_amountAdvance \n" + " from FnaAdvanceInfo fbi \n" + " where fbi.requestid <> " + __requestid + " \n"
+ " GROUP BY fbi.advanceRequestId, fbi.advanceRequestIdDtlId \n" + " ) fbi1 \n" + " where fbi1.sum_amountAdvance > 0 \n"
+ " and fbi1.advanceRequestId = workflow_requestbase.requestId \n" + " ) \n";
}
/* end处理还款流程请求浏览按钮过滤逻辑代码 */
return sqlwhere;
}
/**
* EM
* @param apidatas
* @param user
* @param backfields
* @param formsql
* @param orderby
*/
private void getTableString4EMShare(Map <String, Object> apidatas, User user, String backfields, String formsql, String orderby) {
List <SplitTableColBean> cols = new ArrayList <SplitTableColBean>();
cols.add(new SplitTableColBean("true", "id").setBelong(BelongAttr.PCMOBILE));
cols.add(new SplitTableColBean("50%",
SystemEnv.getHtmlLabelName(26876, user.getLanguage()),
"requestnamenew", "requestnamenew", "com.api.browser.service.impl.RequestBrowserService.getRequestNameWithOutHtml","column:id+" + user.getLanguage()+"+column:requestname",1).setIsInputCol(BoolAttr.TRUE).setBelong(BelongAttr.PCMOBILE));
cols.add(new SplitTableColBean("25%",
SystemEnv.getHtmlLabelName(882, user.getLanguage()),
"creater", "creater",
"weaver.workflow.request.RequestBrowser.getWfCreaterName",
"column:creatertype+" + user.getLanguage()).setBelong(BelongAttr.PCMOBILE).setMobileviewtype(MobileViewTypeAttr.DETAIL));
cols.add(new SplitTableColBean("25%",
SystemEnv.getHtmlLabelName(1339, user.getLanguage()),
"createdate", "createdate",
"com.api.browser.service.impl.RequestBrowserService.getCreateTime",
"column:createtime").setBelong(BelongAttr.PCMOBILE).setMobileviewtype(MobileViewTypeAttr.DETAIL));
SplitTableBean tableBean = new SplitTableBean(backfields, formsql, "", orderby, "id", cols);
tableBean.setSqlisdistinct("true");
//移动端多列
tableBean.setMobileshowtype(MobileShowTypeAttr.ListView);
try {
tableBean.createMobileTemplate(JSON.parseArray(JSON_CONFIG_2, SplitMobileDataBean.class));
} catch (Exception e) {
e.printStackTrace();
}
apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
}
private void getTableString(Map <String, Object> apidatas, User user, String backfields, String formsql, String orderby, String importWfBrow, int ismobile) {
List <SplitTableColBean> cols = new ArrayList <SplitTableColBean>();
cols.add(new SplitTableColBean("true", "id").setBelong(BelongAttr.PCMOBILE));
cols.add(new SplitTableColBean("true", "requestname").setIsInputCol(BoolAttr.TRUE).setBelong(BelongAttr.PCMOBILE));
if ("1".equals(importWfBrow)) {
cols.add(new SplitTableColBean("50%",
SystemEnv.getHtmlLabelName(26876, user.getLanguage()), "requestname", "requestname",
"com.api.browser.service.impl.RequestBrowserService.getRequestnameWithLink", "column:id+" + user.getLanguage() + "+column:requestname", 1));
cols.add(new SplitTableColBean("25%",
SystemEnv.getHtmlLabelName(882, user.getLanguage()),
"creater", "creater",
"weaver.general.WorkFlowTransMethod.getWFSearchResultName", "column:creatertype"));
} else {
cols.add(new SplitTableColBean("50%",
SystemEnv.getHtmlLabelName(26876, user.getLanguage()),
"requestnamenew", "requestnamenew",
"com.api.browser.service.impl.RequestBrowserService.getRequestname",
"column:id+" + user.getLanguage() + "+column:requestname", 1).setBelong(BelongAttr.PCMOBILE));
cols.add(new SplitTableColBean("25%",
SystemEnv.getHtmlLabelName(882, user.getLanguage()),
"creater", "creater",
"weaver.workflow.request.RequestBrowser.getWfCreaterName",
"column:creatertype+" + user.getLanguage()).setBelong(BelongAttr.PCMOBILE).setMobileviewtype(MobileViewTypeAttr.DETAIL));
}
//cols.add(new SplitTableColBean("60%",SystemEnv.getHtmlLabelName(648, user.getLanguage()),"requestnamenew","requestnamenew",1));
cols.add(new SplitTableColBean("25%",
SystemEnv.getHtmlLabelName(1339, user.getLanguage()),
"createdate", "createdate",
"com.api.browser.service.impl.RequestBrowserService.getCreateTime",
"column:createtime").setBelong(BelongAttr.PCMOBILE).setMobileviewtype(MobileViewTypeAttr.DETAIL));
SplitTableBean tableBean = new SplitTableBean(backfields, formsql, "", orderby, "id", cols);
tableBean.setSqlisdistinct("true");
//移动端多列
tableBean.setMobileshowtype(MobileShowTypeAttr.ListView);
try {
if ("1".equals(importWfBrow)) {
tableBean.createMobileTemplate(JSON.parseArray(JSON_CONFIG, SplitMobileDataBean.class));
}else{
tableBean.createMobileTemplate(JSON.parseArray(JSON_CONFIG_2, SplitMobileDataBean.class));
}
} catch (Exception e) {
e.printStackTrace();
}
apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
}
@Override
public Map <String, Object> getMultBrowserDestData(Map <String, Object> params) throws Exception {
Map <String, Object> apidatas = new HashMap <String, Object>();
String resourceids = Util.null2String(params.get(BrowserConstant.BROWSER_MULT_DEST_SELECTIDS));
if ("".equals(resourceids)) return apidatas;
String sql = "select requestid,creatertype,requestname, requestnamenew,creater,createdate,createtime from workflow_requestbase where requestid in (" + resourceids + ")";
RecordSet rs = new RecordSet();
rs.executeSql(sql);
ResourceComInfo resComInfo = new ResourceComInfo();
CustomerInfoComInfo crmComInfo = new CustomerInfoComInfo();
List <Map <String, Object>> datas = new ArrayList <Map <String, Object>>();
while (rs.next()) {
String request_id = Util.null2String(rs.getString("requestid"));
String creater_name = Util.null2String(rs.getString("creater"));
String create_date = Util.null2String(rs.getString("createdate"));
String create_time = Util.null2String(rs.getString("createtime"));
String request_name = Util.null2String(rs.getString("requestname"));
String request_name_new = getRequestname("", request_id + "+" + user.getLanguage() + "+" + request_name);
String createtype = Util.null2String(rs.getString("createtype"));
if ("1".equals(createtype)) {
creater_name = crmComInfo.getCustomerInfoname(creater_name);
} else {
creater_name = resComInfo.getResourcename(creater_name);
}
Map <String, Object> item = new HashMap <String, Object>();
item.put("id", request_id);
item.put("requestname", request_name);
item.put("requestnamespan", request_name);
item.put("requestnamenew", request_name_new);
item.put("creater", creater_name);
item.put("createdate", create_date + " " + create_time);
datas.add(item);
}
// apidatas.put(BrowserConstant.BROWSER_RESULT_COLUMN, tableHeadColumns);
apidatas.put(BrowserConstant.BROWSER_RESULT_DATA, BrowserBaseUtil.sortDatas(datas, resourceids, "id"));
apidatas.put(BrowserConstant.BROWSER_RESULT_TYPE, BrowserDataType.LIST_ALL_DATA.getTypeid());
return apidatas;
}
@Override
public Map <String, Object> getBrowserConditionInfo(Map <String, Object> params) throws Exception {
Map <String, Object> apidatas = new HashMap <String, Object>();
List <SearchConditionItem> conditions = new ArrayList <SearchConditionItem>();
apidatas.put(BrowserConstant.BROWSER_RESULT_CONDITIONS, conditions);
ConditionFactory conditionFactory = new ConditionFactory(user, !"16".equals(browserType));
//流程导入浏览框条件
String importWfBrow = Util.null2String(params.get("importWfBrow"));
if ("1".equals(importWfBrow)) {
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 26876, "requestname", true)); //请求标题
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 714, "requestmark")); //流程编号
//移动端新建流程导入
boolean isFromMobileNewReq = "1".equals(Util.null2String(params.get("ismobile"))) && "1".equals(Util.null2String(params.get("newReq")));
if (!isFromMobileNewReq) {
conditions.add(conditionFactory.createCondition(ConditionType.BROWSER, 882, "creater", "17")); //创建人
}
conditions.add(conditionFactory.createCondition(ConditionType.BROWSER, 19225, "department", "57")); //创建人部门
String[] domKey = {"createdatetype", "createdatestart", "createdateend"};
SearchConditionItem conditonItem = conditionFactory.createCondition(ConditionType.DATE, 722, domKey);
conditonItem.setColSpan(1);
List <SearchConditionOption> dateOptions = BrowserBaseUtil.getDateSelectOption(user.getLanguage(), true, true);
// //设置默认选中区间
// for(SearchConditionOption option:dateOptions){
// option.setSelected(WfAdvanceSearchUtil.PERIOD.equals(option.getKey()));
// }
conditonItem.setLabelcol(3);
conditonItem.setFieldcol(21);
conditonItem.setOptions(dateOptions);
conditions.add(conditonItem);
conditions.add(conditionFactory.createCondition(ConditionType.BROWSER, 782, "prjids", "135"));
WorkflowAllComInfo wfComInfo = new WorkflowAllComInfo();
SearchConditionItem wfItem = conditionFactory.createCondition(ConditionType.BROWSER, 259, "workflowid", "-99991", 32770);
String workflowid = Util.null2String(params.get("workflowid"));
List <Map <String, Object>> replaceDatas = wfItem.getBrowserConditionParam().getReplaceDatas();
if (replaceDatas == null) replaceDatas = new ArrayList <Map <String, Object>>();
Map <String, Object> defaultWf = new HashMap <String, Object>();
defaultWf.put("id", workflowid);
defaultWf.put("name", wfComInfo.getWorkflowname(workflowid));
replaceDatas.add(defaultWf);
wfItem.getBrowserConditionParam().setReplaceDatas(replaceDatas);
conditions.add(wfItem); //流程树
Map <String, Object> dataParams = wfItem.getBrowserConditionParam().getDataParams();
dataParams.put("formid", wfComInfo.getFormId(workflowid));
dataParams.put("isbill", wfComInfo.getIsBill(workflowid));
Map <String, Object> completeParams = wfItem.getBrowserConditionParam().getCompleteParams();
completeParams.putAll(dataParams);
//相关项目
conditions.add(conditionFactory.createCondition(ConditionType.BROWSER, 783, "crmids", "18")); //相关客户
//流程状态
List <SearchConditionOption> statuOptions = new ArrayList <SearchConditionOption>();
statuOptions.add(new SearchConditionOption("0", SystemEnv.getHtmlLabelName(332, user.getLanguage()), isFromMobileNewReq));
statuOptions.add(new SearchConditionOption("2", SystemEnv.getHtmlLabelName(18800, user.getLanguage()), !isFromMobileNewReq));
statuOptions.add(new SearchConditionOption("1", SystemEnv.getHtmlLabelName(17999, user.getLanguage())));
conditions.add(conditionFactory.createCondition(ConditionType.SELECT, 15112, "status", statuOptions));
return apidatas;
}
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 26876, "requestname", true)); //请求标题
SearchConditionItem wfCondition = conditionFactory.createCondition(ConditionType.BROWSER, 33806, "workflowid", "-99991", 32770);
wfCondition.getBrowserConditionParam().setIsSingle(false);
conditions.add(wfCondition); //流程树
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 714, "requestmark")); //流程编号
conditions.add(conditionFactory.createCondition(ConditionType.BROWSER, 882, "creater", "17")); //创建人
conditions.add(conditionFactory.createCondition(ConditionType.BROWSER, 19225, "department", "57")); //创建人部门
conditions.add(conditionFactory.createCondition(ConditionType.BROWSER, 22788, "subid", "194")); //分部多选
String[] domKey = {"createdatetype", "createdatestart", "createdateend"};
SearchConditionItem conditonItem = conditionFactory.createCondition(ConditionType.DATE, 722, domKey);
conditonItem.setColSpan(1);
conditonItem.setLabelcol("16".equals(browserType) ? 3 : 8);
conditonItem.setFieldcol("16".equals(browserType) ? 21 : 16);
conditonItem.setOptions(BrowserBaseUtil.getDateSelectOption(user.getLanguage(), true, true));
conditions.add(conditonItem);
conditions.add(conditionFactory.createCondition(ConditionType.BROWSER, 782, "prjids", "135")); //相关项目
conditions.add(conditionFactory.createCondition(ConditionType.BROWSER, 783, "crmids", "18")); //相关客户
//流程状态
if (!"171".equals(browserType)) {
List <SearchConditionOption> statuOptions = new ArrayList <SearchConditionOption>();
statuOptions.add(new SearchConditionOption("", ""));
statuOptions.add(new SearchConditionOption("1", SystemEnv.getHtmlLabelName(17999, user.getLanguage())));
statuOptions.add(new SearchConditionOption("2", SystemEnv.getHtmlLabelName(18800, user.getLanguage())));
conditions.add(conditionFactory.createCondition(ConditionType.SELECT, 15112, "status", statuOptions));
}
//接收期间
String date2durings = Util.null2String(new BaseBean().getPropValue("wfdateduring", "wfdateduring"));
String[] date2duringTokens = Util.TokenizerString2(date2durings, ",");
List <SearchConditionOption> dataOptions = new ArrayList <SearchConditionOption>();
//判断微搜接口是否可用
SearchBrowserUtils searchBrowserUtils = new SearchBrowserUtils();
boolean wfSearch = searchBrowserUtils.quickSearchValidate("WFSEARCH", user.getLanguage() + "");
if(wfSearch) wfSearch = validQuickSearch(params);
boolean date2duringDefaultSelected = !wfSearch;
for (String _date2during : date2duringTokens) {
if ("".equals(Util.null2String(_date2during))) continue;
dataOptions.add(new SearchConditionOption(_date2during, SystemEnv.getHtmlLabelName(24515, user.getLanguage()) + _date2during + SystemEnv.getHtmlLabelName(26301, user.getLanguage()), date2duringDefaultSelected));
if (date2duringDefaultSelected) date2duringDefaultSelected = false;
}
dataOptions.add(new SearchConditionOption("38", SystemEnv.getHtmlLabelName(332, user.getLanguage()), wfSearch));
conditions.add(conditionFactory.createCondition(ConditionType.SELECT, 31787, "date2during", dataOptions));
return apidatas;
}
public String getRequestnameWithLink(String requestnamenew, String para){
int requestid = Util.getIntValue(para.substring(0, para.indexOf("+")));
String result = getRequestname(requestnamenew, para);
result = "<a style = \"text-decoration: none\" href=\"javaScript:openFullWindowHaveBar(\'/workflow/request/ViewRequestForwardSPA.jsp?requestid=" + requestid + "\')\">" + result + "</a>";
return result;
}
public String getRequestname(String requestnamenew, String para) {
//String[] paraarr = para.split("\\+");
int requestid = Util.getIntValue(para.substring(0, para.indexOf("+")));
para = para.substring(para.indexOf("+") + 1);
int languageid = Util.getIntValue(para.substring(0, para.indexOf("+")));
String requestname = para.substring(para.indexOf("+") + 1);
RecordSet rs = new RecordSet();
rs.executeQuery("select id,formid,isbill from workflow_base t1 where exists (select 1 from workflow_requestbase t2 where t2.workflowid = t1.id and t2.requestid = ? )", requestid);
int workflowid = 0;
int formid = 0;
int isbill = 0;
if (rs.next()) {
workflowid = rs.getInt(1);
formid = rs.getInt(2);
isbill = rs.getInt(3);
}
RequestBaseUtil rbu = new RequestBaseUtil();
requestname = rbu.formatRequestname(requestname, workflowid+"", requestid+"",isbill,formid,languageid);
return requestname;
}
/**
* html
* @param requestnamenew
* @param para
* @return
*/
public String getRequestNameWithOutHtml(String requestnamenew, String para) {
String requestName = this.getRequestname(requestnamenew,para);
return Util.delHtmlWithSpace(requestName);
}
public String getWfOnlyViewLink(String requestname, String requestid) {
RecordSet rs = new RecordSet();
rs.executeQuery("select id,formid,isbill from workflow_base t1 where exists (select 1 from workflow_requestbase t2 where t2.workflowid = t1.id and t2.requestid = ? )", requestid);
int workflowid = 0;
int formid = 0;
int isbill = 0;
if (rs.next()) {
workflowid = rs.getInt(1);
formid = rs.getInt(2);
isbill = rs.getInt(3);
}
int languageid = null==user?7:user.getLanguage();
RequestBaseUtil rbu = new RequestBaseUtil();
requestname = rbu.formatRequestname(requestname, workflowid+"", requestid+"",isbill,formid,languageid);
return "<a href=javaScript:openFullWindowHaveBar(\'/workflow/request/ViewRequestForwardSPA.jsp?isonlyview=1&requestid=" + requestid + "\')>" + requestname + "</a>";
}
public String getCreateTime(String createdate, String createtime) {
return createdate + " " + createtime;
}
/**
*
*
* @param params
* @return
*/
private boolean validQuickSearch(Map <String, Object> params) {
List <String> paramKey = new ArrayList <String>();
paramKey.add("formid");
paramKey.add("importWfBrow");
paramKey.add("collReq");
paramKey.add(BrowserConstant.SPELL_SQL_WHERE);
Iterator <String> it = params.keySet().iterator();
while (it.hasNext()) {
String key = it.next();
if (paramKey.contains(key)) {
return false;
}
if (!"fieldid".equalsIgnoreCase(key) && key.indexOf("field") > -1) {
return false;
}
if ("date2during".equals(key)) {
String date2during = Util.null2String(params.get("date2during"));
if (!("38".equals(date2during) || "".equals(date2during))) {
return false;
}
}
if(SEC_LEVEL.equals(key) && HrmClassifiedProtectionBiz.isOpenClassification() && !SearchBrowserUtils.isSupportSecretLevel()) {
return false;
}
}
//判断微搜接口是否可用
SearchBrowserUtils searchBrowserUtils = new SearchBrowserUtils();
return searchBrowserUtils.quickSearchValidate("WFSEARCH", user.getLanguage() + "");
}
@Override
public Map <String, Object> browserAutoComplete(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> apidatas = new HashMap<String, Object>();
String fnaSqlWhere = fnaUtils(dataDefinitionParams);
boolean isQuickSearch = validQuickSearch(dataDefinitionParams);
List<Object> datas = new ArrayList<Object>();
String q = Util.null2String(request.getParameter("q"));
dataDefinitionParams.put("requestname",q);
if (isQuickSearch && "".equals(fnaSqlWhere)) {
//数据处理
if ("171".equals(browserType)) dataDefinitionParams.put("currentnodetype", 3);
Map<String,Object> newDataDefinitionParams = this.reSetDataDefinitionParams(); // 重新设置微搜参数,无值参数不放入 dataDefinitionParams中
List<Object> tempDatas = new RequestQuickSearchBiz().getRequestData(user,newDataDefinitionParams,PAGENUM);
if(tempDatas != null && tempDatas.size() > 0) {
for(Object rowItem : tempDatas) {
Map<String,String> row = (Map<String,String>) rowItem;
Map<String,Object> item = new HashMap<String,Object>();
item.put(BrowserConstant.BROWSER_AUTO_COMPLETE_PRIMARY_KEY,row.get("id"));
item.put(BrowserConstant.BROWSER_AUTO_COMPLETE_SHOW_NAME,row.get("requestname"));
datas.add(item);
}
}
} else {
String backfields = "t.id,t.requestname,t.createdate,t.createtime";
String orderby = " createdate desc, createtime desc";
String fromsql = getFromSql(dataDefinitionParams,fnaSqlWhere);
String sql = SqlUtils.getPageSql(backfields,fromsql,orderby,0,PAGENUM);
RecordSet rs = new RecordSet();
rs.executeQuery(sql);
while(rs.next()){
Map<String,Object> item = new HashMap<String,Object>();
item.put(BrowserConstant.BROWSER_AUTO_COMPLETE_PRIMARY_KEY, rs.getString("id"));
item.put(BrowserConstant.BROWSER_AUTO_COMPLETE_SHOW_NAME, rs.getString("requestname"));
datas.add(item);
}
}
apidatas.put(BrowserConstant.BROWSER_RESULT_DATA, datas);
return apidatas;
}
/**
* dataDefinitionParams
*/
private Map<String,Object> reSetDataDefinitionParams() {
Map<String,Object> newDefinitionParams = new HashMap<String,Object>();
for(Map.Entry<String,Object> entry : dataDefinitionParams.entrySet()){
if(!"".equals(Util.null2String(entry.getValue()))){
newDefinitionParams.put(entry.getKey(), entry.getValue());
}
}
return newDefinitionParams;
}
private String getFromSql(Map <String, Object> params, String fnaSqlWhere) {
StringBuilder sqlwhere = new StringBuilder();
sqlwhere.append(" where 1=1 ").append(Util.null2String(params.get(BrowserConstant.SPELL_SQL_WHERE)));
String importWfBrow = Util.null2String(params.get("importWfBrow"));
String userID = String.valueOf(user.getUID());
int userid = user.getUID();
RecordSet rs = new RecordSet();
HrmUserSettingComInfo settingComInfo = new HrmUserSettingComInfo();
String belongtoshow = settingComInfo.getBelongtoshow(userID+"");
String usertype = "0";
if ("2".equals(user.getLogintype())) usertype = "1";
int formid = Util.getIntValue(Util.null2String(params.get("formid")), 0);
int isbill = Util.getIntValue(Util.null2String(params.get("isbill")), -1);
if (formid != 0 && isbill != -1) {
sqlwhere.append(" and workflow_base.formid = ").append(formid).append(" and workflow_base.isbill = ").append(isbill);
}
sqlwhere.append(fnaSqlWhere);
String requestname = Util.null2String(params.get("requestname"));
String secLevel = Util.null2String(params.get(SEC_LEVEL));
String creater = Util.null2String(params.get("creater"));
String requestmark = Util.null2String(params.get("requestmark"));
String prjids = Util.null2String(params.get("prjids"));
String crmids = Util.null2String(params.get("crmids"));
String workflowid = Util.null2String(params.get("workflowid"));
String department = Util.null2String(params.get("department"));
String status = Util.null2String(params.get("status"));
String subid = Util.null2String(params.get("subid"));
int olddate2during = 0;
String date2durings = Util.null2String(rs.getPropValue("wfdateduring", "wfdateduring"));
String[] date2duringTokens = Util.TokenizerString2(date2durings, ",");
if (date2duringTokens.length > 0) {
olddate2during = Util.getIntValue(date2duringTokens[0], 0);
}
if (olddate2during < 0 || olddate2during > 36) {
olddate2during = 0;
}
int date2during = Util.getIntValue(Util.null2String(params.get("date2during")), olddate2during);
if (!"".equals(requestname)) {
String findStr = Util.fromScreen2(requestname, user.getLanguage());
findStr = findStr.replace("/", "//");
if(!"oracle".equals(rs.getDBType())) {
findStr = findStr.replace("[", "/[");
findStr = findStr.replace("]", "/]");
}
findStr = findStr.replace("_", "/_");
findStr = findStr.replace("%", "/%");
if(Util.isEnableMultiLang()) {
if ("sqlserver".equals(rs.getDBType())) {
sqlwhere.append(" and dbo.convToMultiLang(requestnamenew," + user.getLanguage() + ") like '%").append(findStr).append("%'");
} else {
sqlwhere.append(" and convToMultiLang(requestnamenew," + user.getLanguage() + ") like '%").append(findStr).append("%'");
}
} else {
sqlwhere.append(" and requestnamenew like '%").append(findStr).append("%'");
}
sqlwhere.append(" escape '/' ");
}
if (!"".equals(workflowid) && !"0".equals(workflowid)) {
sqlwhere.append(" and workflow_requestbase.workflowid in (").append(WorkflowVersion.getAllVersionStringByWFIDs(workflowid)).append(")");
}
if (!"".equals(secLevel) && HrmClassifiedProtectionBiz.isOpenClassification()) {//开启涉密系统,拼接密级条件
sqlwhere.append(" and workflow_requestbase.seclevel >= " + secLevel + " ");
}
if (!"".equals(requestmark)) {
sqlwhere.append(" and requestmark like '%").append(requestmark).append("%'");
}
if ("1".equals(importWfBrow)) {
String importWfOnlyYouCreateWfids = Util.null2String(rs.getPropValue("workflowbase", "importWfOnlyYouCreateWfids"));
//判断流程表单是否相同
boolean flag = false;
if (!"".equals(importWfOnlyYouCreateWfids)) {
String wfids = WorkflowVersion.getAllVersionStringByWFIDs(importWfOnlyYouCreateWfids);
WorkflowAllComInfo wfComInfo = new WorkflowAllComInfo();
List <String> wfidArr = Util.splitString2List(wfids, ",");
for (String wfid : wfidArr) {
if (Util.getIntValue(wfComInfo.getFormId(wfid)) == formid && Util.getIntValue(wfComInfo.getIsBill(wfid)) == isbill) {
flag = true;
break;
}
}
}
if (flag) {
sqlwhere.append(" and creater = ").append(user.getUID()).append(" and usertype=0 ");
} else {
sqlwhere.append(" and workflow_currentoperator.userid = ").append(user.getUID()).append(" and creatertype="+usertype+" ");
}
}
if (!"".equals(creater)) {
//流程导入不可以导入非自己创建的流程ID
sqlwhere.append(" and creater in (").append(creater).append(") and creatertype="+usertype+" ");
}
if (!"".equals(department) && !"0".equals(department)) {
sqlwhere.append(" and workflow_requestbase.creater in (select id from hrmresource where departmentid in (").append(department).append("))");
}
if (!"".equals(subid) && !"0".equals(subid)) {
sqlwhere.append(" and workflow_requestbase.creater in (select id from hrmresource where subcompanyid1 in (").append(subid).append("))");
}
try {
sqlwhere.append(AdvanceSerarchUtil.handDateCondition("createdatetype", "createdatestart", "createdateend", "createdate", params));
} catch (ParseException e) {
e.printStackTrace();
}
if (!"".equals(prjids) && !"0".equals(prjids)) {
String[] prjidAry = prjids.split(",");
if (prjidAry.length > 0) {
sqlwhere.append(" AND (");
if ("oracle".equals(rs.getDBType())) {
for (int i = 0; i < prjidAry.length; i++) {
if (i > 0) {
sqlwhere.append(" OR ");
}
sqlwhere.append("(concat(concat(',' , To_char(workflow_requestbase.prjids)) , ',') LIKE '%," + prjidAry[i] + ",%')");
}
} else if ("mysql".equals(rs.getDBType())) {
for (int i = 0; i < prjidAry.length; i++) {
if (i > 0) {
sqlwhere.append(" OR ");
}
sqlwhere.append("(concat(',' , workflow_requestbase.prjids , ',') LIKE '%," + prjidAry[i] + ",%')");
}
}
else if ("postgresql".equals(rs.getDBType())) {
for (int i = 0; i < prjidAry.length; i++) {
if (i > 0) {
sqlwhere.append(" OR ");
}
sqlwhere.append("(concat(concat(',' , To_char(workflow_requestbase.prjids)) , ',') LIKE '%," + prjidAry[i] + ",%')");
}
}
else {
for (int i = 0; i < prjidAry.length; i++) {
if (i > 0) {
sqlwhere.append(" OR ");
}
sqlwhere.append("(',' + CONVERT(varchar,workflow_requestbase.prjids) + ',' LIKE '%," + prjidAry[i] + ",%')");
}
}
sqlwhere.append(") ");
}
}
if (!"".equals(crmids) && !"0".equals(crmids)) {
String[] crmidAry = crmids.split(",");
if (crmidAry.length > 0) {
sqlwhere.append(" AND (");
if ("oracle".equals(rs.getDBType())) {
for (int i = 0; i < crmidAry.length; i++) {
if (i > 0) {
sqlwhere.append(" OR ");
}
sqlwhere.append("(concat(concat(',' , To_char(workflow_requestbase.crmids)) , ',') LIKE '%," + crmidAry[i] + ",%')");
}
} else if ("mysql".equals(rs.getDBType())) {
for (int i = 0; i < crmidAry.length; i++) {
if (i > 0) {
sqlwhere.append(" OR ");
}
sqlwhere.append("(concat(',' , workflow_requestbase.crmids , ',') LIKE '%," + crmidAry[i] + ",%')");
}
}
else if ("postgresql".equals(rs.getDBType())) {
for (int i = 0; i < crmidAry.length; i++) {
if (i > 0) {
sqlwhere.append(" OR ");
}
sqlwhere.append("(concat(concat(',' , To_char(workflow_requestbase.crmids)) , ',') LIKE '%," + crmidAry[i] + ",%')");
}
}
else {
for (int i = 0; i < crmidAry.length; i++) {
if (i > 0) {
sqlwhere.append(" OR ");
}
sqlwhere.append("(',' + CONVERT(varchar,workflow_requestbase.crmids) + ',' LIKE '%," + crmidAry[i] + ",%')");
}
}
sqlwhere.append(") ");
}
}
if ("1".equals(status)) {
sqlwhere.append(" and currentnodetype < 3 ");
} else if ("2".equals(status)) {
sqlwhere.append(" and currentnodetype = 3 ");
}
WorkflowComInfo wci = new WorkflowComInfo();
if (!"1".equals(importWfBrow)) {
sqlwhere.append(wci.getDateDuringSql(date2during));
}
if (" where 1=1 ".equals(sqlwhere)) {
sqlwhere.append(" and workflow_requestbase.requestid <> 0");
}
if ("oracle".equals(rs.getDBType())) {
sqlwhere.append(" and (nvl(workflow_requestbase.currentstatus,-1) = -1 or (nvl(workflow_requestbase.currentstatus,-1)=0 and workflow_requestbase.creater=" + user.getUID() + "))");
} else if ("mysql".equals(rs.getDBType())) {
sqlwhere.append(" and (ifnull(workflow_requestbase.currentstatus,-1) = -1 or (ifnull(workflow_requestbase.currentstatus,-1)=0 and workflow_requestbase.creater=" + user.getUID() + "))");
} else {
sqlwhere.append(" and (isnull(workflow_requestbase.currentstatus,-1) = -1 or (isnull(workflow_requestbase.currentstatus,-1)=0 and workflow_requestbase.creater=" + user.getUID() + "))");
}
//我的收藏
boolean collReq = "1".equals(Util.null2String(params.get("collReq")));
if (collReq) {
sqlwhere.append(" and exists (select 1 from SysFavourite t1 where t1.favouriteobjid = workflow_requestbase.requestid and t1.favouritetype = 2 and t1.resourceid = " + user.getUID() + ") ");
}
//EM分享排查必须加密分享流程
int isFormEMShare = Util.getIntValue(Util.null2String(params.get("isFormEMShare")), -1);
if(isFormEMShare == 1){
String str1 = ServiceUtil.getDBJudgeNullFun(rs.getDBType())+"(workflow_base.isencryptshare, '0')";
String str2 = ServiceUtil.getDBJudgeNullFun(rs.getDBType())+"(workflow_base.encryptrange, '0')";
sqlwhere.append(" and (workflow_base.isencryptshare = '' or "+str1+"='0' or ("+str1+"='1' and "+str2+"='1'))");
}
String fromsql = "";
if ("1".equals(belongtoshow)) {
if (rs.getDBType().equals("oracle") || rs.getDBType().equals("db2")) {
fromsql = " from ("
+ " select distinct workflow_requestbase.requestid as id,requestnamenew,requestname,creater,creatertype,createdate,createtime from workflow_requestbase , workflow_currentoperator , workflow_base"
+ sqlwhere.toString() + " and workflow_currentoperator.requestid = workflow_requestbase.requestid and workflow_currentoperator.userid in (" + userid
+ ") and workflow_currentoperator.usertype=" + usertype
+ " and workflow_requestbase.workflowid = workflow_base.id and (workflow_base.isvalid='1' or workflow_base.isvalid='3') " + " ) t ";
} else if (rs.getDBType().equals("mysql")) {
fromsql = " from ("
+ " select distinct workflow_requestbase.requestid as id,requestnamenew,requestname,creater,creatertype,createdate,createtime from workflow_requestbase , workflow_currentoperator , workflow_base"
+ sqlwhere.toString() + " and workflow_currentoperator.requestid = workflow_requestbase.requestid and workflow_currentoperator.userid in (" + userid
+ ") and workflow_currentoperator.usertype=" + usertype
+ " and workflow_requestbase.workflowid = workflow_base.id and (workflow_base.isvalid='1' or workflow_base.isvalid='3') " + " ) t ";
}
else if (rs.getDBType().equals("postgresql")) {
fromsql = " from ("
+ " select distinct workflow_requestbase.requestid as id,requestnamenew,requestname,creater,creatertype,createdate,createtime from workflow_requestbase , workflow_currentoperator , workflow_base"
+ sqlwhere.toString() + " and workflow_currentoperator.requestid = workflow_requestbase.requestid and workflow_currentoperator.userid in (" + userid
+ ") and workflow_currentoperator.usertype=" + usertype
+ " and workflow_requestbase.workflowid = workflow_base.id and (workflow_base.isvalid='1' or workflow_base.isvalid='3') " + " ) t ";
}
else {
fromsql = " from ("
+ " select distinct workflow_requestbase.requestid as id,requestnamenew,requestname,creater,creatertype,createdate,createtime from workflow_requestbase , workflow_currentoperator , workflow_base"
+ sqlwhere.toString() + " and workflow_currentoperator.requestid = workflow_requestbase.requestid and workflow_currentoperator.userid in (" + userid
+ ") and workflow_currentoperator.usertype=" + usertype
+ " and workflow_requestbase.workflowid = workflow_base.id and (workflow_base.isvalid='1' or workflow_base.isvalid='3') " + " ) t ";
}
} else {
if (rs.getDBType().equals("oracle") || rs.getDBType().equals("db2")) {
fromsql = " from ("
+ " select distinct workflow_requestbase.requestid as id,requestnamenew,requestname,creater,creatertype,createdate,createtime from workflow_requestbase , workflow_currentoperator , workflow_base"
+ sqlwhere.toString() + " and workflow_currentoperator.requestid = workflow_requestbase.requestid and workflow_currentoperator.userid=" + userid
+ " and workflow_currentoperator.usertype=" + usertype
+ " and workflow_requestbase.workflowid = workflow_base.id and (workflow_base.isvalid='1' or workflow_base.isvalid='3') " + " ) t ";
} else if (rs.getDBType().equals("mysql")) {
fromsql = " from ("
+ " select distinct workflow_requestbase.requestid as id,requestnamenew,requestname,creater,creatertype,createdate,createtime from workflow_requestbase , workflow_currentoperator , workflow_base"
+ sqlwhere.toString() + " and workflow_currentoperator.requestid = workflow_requestbase.requestid and workflow_currentoperator.userid=" + userid
+ " and workflow_currentoperator.usertype=" + usertype
+ " and workflow_requestbase.workflowid = workflow_base.id and (workflow_base.isvalid='1' or workflow_base.isvalid='3') " + " ) t ";
}
else if (rs.getDBType().equals("postgresql")) {
fromsql = " from ("
+ " select distinct workflow_requestbase.requestid as id,requestnamenew,requestname,creater,creatertype,createdate,createtime from workflow_requestbase , workflow_currentoperator , workflow_base"
+ sqlwhere.toString() + " and workflow_currentoperator.requestid = workflow_requestbase.requestid and workflow_currentoperator.userid=" + userid
+ " and workflow_currentoperator.usertype=" + usertype
+ " and workflow_requestbase.workflowid = workflow_base.id and (workflow_base.isvalid='1' or workflow_base.isvalid='3') " + " ) t ";
}
else {
fromsql = " from ("
+ " select distinct workflow_requestbase.requestid as id,requestnamenew,requestname,creater,creatertype,createdate,createtime from workflow_requestbase , workflow_currentoperator , workflow_base"
+ sqlwhere.toString() + " and workflow_currentoperator.requestid = workflow_requestbase.requestid and workflow_currentoperator.userid=" + userid
+ " and workflow_currentoperator.usertype=" + usertype
+ " and workflow_requestbase.workflowid = workflow_base.id and (workflow_base.isvalid='1' or workflow_base.isvalid='3') " + " ) t ";
}
}
return fromsql;
}
private void eSearchParamsTrans(Map<String, Object> params) {
/*String userID = String.valueOf(user.getUID());
HrmUserSettingComInfo settingComInfo = new HrmUserSettingComInfo();
String belongtoshow = settingComInfo.getBelongtoshow(userID+"");
if ("1".equals(belongtoshow)) {//开启主次账号显示,微搜也加上主次账号搜索的参数
params.put("belongtoShow","1");
}*/
//浏览按钮不处理主次账号统一显示,会导致两条没有操作者交集的流程关联在一起,出现无权限
if(params.containsKey(SEC_LEVEL)) {
String value = Util.null2String(params.get(SEC_LEVEL));
params.put(SEC_LEVEL, new RequestSecLevelBiz().getFullSecLevel(Util.getIntValue(value)));
}
}
}

@ -5,7 +5,6 @@ import com.engine.core.cfg.annotation.CommandDynamicProxy;
import com.engine.core.interceptor.AbstractCommandProxy;
import com.engine.core.interceptor.Command;
import com.engine.hrm.cmd.jobset.AddJobGroupCmd;
import com.engine.hrm.cmd.jobset.EditJobGroupCmd;
import org.apache.commons.lang.StringUtils;
import weaver.general.BaseBean;
import weaver.general.Util;

@ -5,14 +5,11 @@ import com.engine.core.cfg.annotation.CommandDynamicProxy;
import com.engine.core.interceptor.AbstractCommandProxy;
import com.engine.core.interceptor.Command;
import com.engine.hrm.cmd.jobset.EditJobGroupCmd;
import com.engine.hrm.cmd.jobset.GetJobDetailCmd;
import org.apache.commons.lang.StringUtils;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**

@ -1,7 +1,5 @@
package com.customization.sskj;
import cn.hutool.core.date.DateUtil;
import com.api.prj.cmd.task.GetTaskFormItemCmd;
import com.engine.core.cfg.annotation.CommandDynamicProxy;
import com.engine.core.interceptor.AbstractCommandProxy;
import com.engine.core.interceptor.Command;

@ -5,18 +5,12 @@ import com.engine.core.cfg.annotation.CommandDynamicProxy;
import com.engine.core.interceptor.AbstractCommandProxy;
import com.engine.core.interceptor.Command;
import com.engine.hrm.cmd.jobset.GetJobDetailCmd;
import com.engine.kq.cmd.myattendance.GetHrmKQMonthReportInfoCmd;
import org.apache.commons.lang.StringUtils;
import weaver.general.Util;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
*

@ -6,12 +6,10 @@ import com.customization.sskj.util.JobGroupUtil;
import com.engine.core.cfg.annotation.CommandDynamicProxy;
import com.engine.core.interceptor.AbstractCommandProxy;
import com.engine.core.interceptor.Command;
import com.engine.hrm.cmd.jobset.GetJobDetailCmd;
import com.engine.hrm.cmd.jobset.GetJobGroupFormCmd;
import org.apache.commons.lang.StringUtils;
import weaver.general.Util;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@ -1,12 +1,9 @@
package com.customization.sskj;
import com.customization.sskj.util.JobGroupUtil;
import com.engine.core.cfg.annotation.CommandDynamicProxy;
import com.engine.core.interceptor.AbstractCommandProxy;
import com.engine.core.interceptor.Command;
import com.engine.hrm.cmd.jobset.AddJobGroupCmd;
import com.engine.kq.cmd.reportdetial.GetTabsCmd;
import org.apache.commons.lang.StringUtils;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;

@ -1,12 +1,12 @@
package com.customization.sskj.util;
import cn.hutool.core.date.DateUtil;
import weaver.formmode.setup.ModeRightInfo;
import weaver.hrm.User;
import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.Date;
import java.util.HashMap;

@ -28,7 +28,6 @@ import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
*

@ -6,6 +6,7 @@ import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.KQReportBiz;
import com.engine.kq.biz.KQSettingsBiz;
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
import com.engine.kq.util.ExcelUtil;
import com.engine.kq.util.KQDurationCalculatorUtil;

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.KQFormatBiz;
import com.engine.kq.biz.KQReportBiz;
import com.engine.kq.util.ExcelUtil;
import com.engine.kq.util.KQDurationCalculatorUtil;

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.KQFormatBiz;
import com.engine.kq.biz.KQReportBiz;
import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.util.PageUidFactory;

@ -2,9 +2,9 @@ package com.engine.sskj.controller;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.google.gson.Gson;
import com.engine.sskj.service.EntryService;
import com.engine.sskj.service.impl.EntryServiceImpl;
import com.google.gson.Gson;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;

@ -2,9 +2,7 @@ package com.engine.sskj.controller;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.sskj.service.EntryService;
import com.engine.sskj.service.KqWorkflowService;
import com.engine.sskj.service.impl.EntryServiceImpl;
import com.engine.sskj.service.impl.KqWorkflowServiceImpl;
import com.google.gson.Gson;
import weaver.hrm.HrmUserVarify;

@ -1,6 +1,5 @@
package com.engine.sskj.service.impl;
import cn.hutool.core.date.DateUtil;
import com.engine.core.impl.Service;
import com.engine.kq.biz.KQTimesArrayComInfo;
import com.engine.kq.util.KQDurationCalculatorUtil;

@ -7,7 +7,6 @@ import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean;
import weaver.general.Util;
import javax.xml.transform.Result;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
@ -29,13 +28,25 @@ public class SskjUtil {
/**
*
* @param userId
* @param jobGroupDesModeId
* @param modeId
* @param billid
*/
public void modePerRecon(Integer userId, String jobGroupDesModeId, String billid) {
public void modePerRecon(Integer userId, String modeId, String billid) {
ModeRightInfo ModeRightInfo = new ModeRightInfo();
ModeRightInfo.setNewRight(true);
ModeRightInfo.editModeDataShare( userId, Integer.parseInt(jobGroupDesModeId), Integer.parseInt(billid));
ModeRightInfo.editModeDataShare( userId, Integer.parseInt(modeId), Integer.parseInt(billid));
}
/**
*
* @param billid_creator
* @param modeId
* @param billids
*/
public void modePerReconBatch(Map<Integer,Integer> billid_creator, String modeId, List<Integer> billids) {
ModeRightInfo ModeRightInfo = new ModeRightInfo();
ModeRightInfo.setNewRight(true);
ModeRightInfo.editModeDataShare( billid_creator, Integer.parseInt(modeId), billids);
}
/**

@ -7,6 +7,7 @@ import com.engine.kq.biz.KQFormatBiz;
import com.engine.kq.timer.KQQueue;
import com.engine.kq.timer.KQTaskBean;
import com.engine.kq.wfset.util.SplitActionUtil;
import com.engine.sskj.util.SskjUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.jayway.jsonpath.Configuration;
@ -63,6 +64,8 @@ public class SyncZkKqDataJob extends BaseCronJob {
bb.writeLog("startTime:"+startTime);
bb.writeLog("endTime:"+endTime);
String url = bb.getPropValue("project_sskj", "zkKqUrl");
//获取日志表建模模块ID
String kqSyncLogModeId = bb.getPropValue("project_sskj","kqSyncLogModeId");
// String url = "http://172.16.50.12:8080/api/v2/transaction/get/?key=28688gxdq7wggprje-nxfdqoqetxe5jscuj0h2bhx2jn";
bb.writeLog("url:"+url);
Map<String, String> heads = new HashMap<String, String>();
@ -73,6 +76,7 @@ public class SyncZkKqDataJob extends BaseCronJob {
String back = doPostJsonRequest(url,heads, JSON.toJSONString(dataMap));
bb.writeLog("urlBack:"+back);
bb.writeLog("获取中控的考勤数据--response:"+back);
List<List> logParams = new ArrayList<>();
List<List> lsParams = new ArrayList<>();
List<String> lsFormatData = new ArrayList<>();
Object tempBack = Configuration.defaultConfiguration().jsonProvider().parse(back);
@ -121,6 +125,20 @@ public class SyncZkKqDataJob extends BaseCronJob {
if (!lsFormatData.contains(formatData)) {
lsFormatData.add(formatData);
}
//日志表
List<String> logPa = new ArrayList<>();
logPa.add(signDate);
logPa.add(userid);
logPa.add(signDate);
logPa.add(signTime);
logPa.add(addr);
logPa.add(kqSyncLogModeId);
logPa.add("1");
logPa.add("0");
logPa.add(signDate);
logPa.add(endTime);
logParams.add(logPa);
}
}
}
@ -175,6 +193,36 @@ public class SyncZkKqDataJob extends BaseCronJob {
RecordSet rsB = new RecordSet();
bb.writeLog("开始同步数据");
//记录日志
//获取插入前最大的ID
Integer maxId = -1;
String acqMaxId = "select MAX(id) as id from uf_kqsynclog order by id desc";
rsB.executeQuery(acqMaxId);
while (rsB.next()) {
maxId = Util.getIntValue(Util.null2String(rsB.getString("id")));
}
String addLogSql = "insert into uf_kqsynclog (syncdate, resourceid, kqdate, kqtime, kqalias, " +
" formmodeid, modedatacreater, modedatacreatertype, modedatacreatedate, modedatacreatetime) " +
" values (?,?,?,?,?,?,?,?,?,?,?)";
boolean bLog = rsB.executeBatchSql(addLogSql, logParams);
bb.writeLog("bLog: " + bLog);
if (bLog) {
List<Integer> billids = new ArrayList<>();
Map<Integer,Integer> billid_creator = new HashMap<>();
String acqBillidsSql = "select id from uf_kqsynclog where id > ?";
rsB.executeQuery(acqBillidsSql, maxId);
while (rsB.next()) {
Integer id = Util.getIntValue(Util.null2String(rsB.getString("id")));
billids.add(id);
billid_creator.put(id, 1);
}
if (billids != null && billids.size() > 0) {
SskjUtil ssutil = new SskjUtil();
ssutil.modePerReconBatch(billid_creator, kqSyncLogModeId, billids);
}
}
//删除本次同步数据
bb.writeLog("lsDelParams: " + lsDelParams);
sql = " delete from hrmschedulesign where signfrom='OutDataSourceSyn' and userid =? and signdate = ? and signtime = ? ";

Loading…
Cancel
Save