@ -2,11 +2,17 @@ package com.engine.organization.service.impl;
import com.alibaba.fastjson.JSONArray ;
import com.alibaba.fastjson.JSONObject ;
import com.api.browser.bean.SearchConditionItem ;
import com.api.browser.bean.SearchConditionOption ;
import com.api.hrm.bean.HrmFieldBean ;
import com.api.hrm.util.HrmFieldSearchConditionComInfo ;
import com.cloudstore.dev.api.util.TextUtil ;
import com.engine.core.impl.Service ;
import com.engine.organization.entity.jclimport.po.HrmFormFieldPO ;
import com.engine.organization.entity.jclimport.po.JclSelectItem ;
import com.engine.organization.entity.search.* ;
import com.engine.organization.entity.jclimport.po.CusFormFieldPO ;
import com.engine.organization.entity.search.QuickSearchCondition ;
import com.engine.organization.entity.search.QuickSearchDetail ;
import com.engine.organization.entity.search.QuickSearchField ;
import com.engine.organization.entity.search.QuickSearchSetting ;
import com.engine.organization.entity.search.condition.ConditionOption ;
import com.engine.organization.entity.search.condition.RangeCondition ;
import com.engine.organization.enums.LogModuleNameEnum ;
@ -15,11 +21,11 @@ import com.engine.organization.service.QuickSearchService;
import com.engine.organization.util.db.MapperProxyFactory ;
import org.apache.commons.collections.CollectionUtils ;
import org.apache.commons.lang.StringUtils ;
import org.json.JSONException ;
import weaver.formmode.exttools.impexp.common.DateUtils ;
import weaver.general.BaseBean ;
import weaver.general.Util ;
import weaver.hrm.User ;
import weaver.hrm.resource.ResourceComInfo ;
import weaver.hrm.definedfield.HrmFieldManager ;
import weaver.systeminfo.SystemEnv ;
import java.util.* ;
@ -53,22 +59,18 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
List < QuickSearchCondition > quickSearchConditionList = getQuickSearchMapper ( ) . getQuickSearchConditionList ( user . getUID ( ) , LogModuleNameEnum . RESOURCE . getValue ( ) ) ;
for ( QuickSearchCondition quickSearchCondition : quickSearchConditionList ) {
HrmFormFieldPO formField = getQuickSearchMapper ( ) . getHrmFormFieldByFieldId ( quickSearchCondition . getFieldId ( ) ) ;
RangeCondition condition = new RangeCondition ( ) ;
condition . setLabel ( quickSearchCondition . getCustomName ( ) ) ;
condition . setDomkey ( Collections . singletonList ( formField . getFieldName ( ) ) ) ;
//condition.setShowModel(quickSearchCondition.getShowModel());
condition . setDomkey ( Collections . singletonList ( quickSearchCondition . getFieldId ( ) ) ) ;
// 根据条件字段类型,组装展示样式
switch ( quickSearchCondition . getType ( ) ) {
case 5 :
List < JclSelectItem> selectItemListByFieldId = getQuickSearchMapper ( ) . getSelectItemListByFieldId ( quickSearchCondition . getFieldId ( ) ) ;
if ( CollectionUtils . isEmpty ( select ItemListByFieldId ) ) {
List < SearchConditionOption> selectOptions = getSelectOptions ( quickSearchCondition ) ;
if ( CollectionUtils . isEmpty ( select Options ) ) {
condition . setCom ( "未设置选项" ) ;
} else {
// 字段本身值、判断有无下拉框选项
List < ConditionOption > options = selectItemListByFieldId . stream ( ) . map ( item - > ConditionOption . builder ( ) . key ( item . getSelectValue ( ) ) . showname ( item . getSelectName ( ) ) . build ( ) ) . collect ( Collectors . toList ( ) ) ;
options . add ( ConditionOption . builder ( ) . key ( "-1" ) . showname ( "全部" ) . build ( ) ) ;
List < ConditionOption > options = selectOptions . stream ( ) . map ( item - > ConditionOption . builder ( ) . key ( item . getKey ( ) ) . showname ( item . getShowname ( ) ) . build ( ) ) . collect ( Collectors . toList ( ) ) ;
condition . setOptions ( options ) ;
}
rangeConditions . add ( condition ) ;
@ -76,7 +78,7 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
case 3 :
// 日期类型数据
List < ConditionOption > options = new ArrayList < > ( ) ;
options . add ( ConditionOption . builder ( ) . key ( "0" ) . showname ( SystemEnv . getHtmlLabelName ( 332 , user . getLanguage ( ) ) ) . selected( true ) . build( ) ) ;
options . add ( ConditionOption . builder ( ) . key ( "0" ) . showname ( SystemEnv . getHtmlLabelName ( 332 , user . getLanguage ( ) ) ) . build( ) ) ;
options . add ( ConditionOption . builder ( ) . key ( "1" ) . showname ( SystemEnv . getHtmlLabelName ( 15537 , user . getLanguage ( ) ) ) . build ( ) ) ;
options . add ( ConditionOption . builder ( ) . key ( "2" ) . showname ( SystemEnv . getHtmlLabelName ( 15539 , user . getLanguage ( ) ) ) . build ( ) ) ;
options . add ( ConditionOption . builder ( ) . key ( "3" ) . showname ( SystemEnv . getHtmlLabelName ( 15541 , user . getLanguage ( ) ) ) . build ( ) ) ;
@ -164,17 +166,18 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
apiDatas . put ( "datas" , datas ) ;
//字段下拉框查询
List < QuickSearchOption > quickSearchOptionList = getQuickSearchMapper ( ) . getQuickSearchOptionList ( ) ;
List < CusFormFieldPO > allFieldInfo = getQuickSearchMapper ( ) . getAllFieldInfo ( ) ;
//List<QuickSearchOption> quickSearchOptionList = getQuickSearchMapper().getQuickSearchOptionList();
JSONArray options = new JSONArray ( ) ;
if ( CollectionUtils . isNotEmpty ( quickSearchOptionList ) ) {
for ( QuickSearchOption quickSearchOption : quickSearchOptionList ) {
if ( CollectionUtils . isNotEmpty ( allFieldInfo ) ) {
for ( CusFormFieldPO formFieldPO : allFieldInfo ) {
JSONObject obj = new JSONObject ( ) ;
String fieldHtmlType = Util . null2String ( quickSearchOption . getFieldHtmlType ( ) ) ;
String fieldId = Util . null2String ( quickSearchOption. getFieldId ( ) ) ;
String fieldHtmlType = Util . null2String ( formFieldPO . getFieldHtmlType ( ) ) ;
String fieldId = Util . null2String ( formFieldPO. getScopeId ( ) + "_" + formFieldPO . getTableName ( ) + "_" + formFieldPO . getFieldName ( ) ) ;
// String fieldName = Util.null2String(quickSearchOption.getFieldName());
String type = Util . null2String ( quickSearchOption . getType ( ) ) ;
int fieldLabel = Util . getIntValue ( quickSearchOption . getFieldLabel ( ) , 0 ) ;
String labelName = SystemEnv . getHtmlLabelName ( Util . getIntValue ( quickSearchOption . getFieldLabel ( ) ) , user . getLanguage ( ) ) ;
String type = Util . null2String ( formFieldPO . getType ( ) ) ;
int fieldLabel = Util . getIntValue ( formFieldPO . getFieldLabel ( ) , 0 ) ;
String labelName = SystemEnv . getHtmlLabelName ( Util . getIntValue ( formFieldPO . getFieldLabel ( ) ) , user . getLanguage ( ) ) ;
String fieldType = "2" ;
boolean isShowModel = false ;
if ( "1" . equals ( fieldHtmlType ) ) {
@ -419,818 +422,45 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
return apiDatas ;
}
// public JSONArray GetQuickSearchInfo(String customid, User user, HttpServletRequest request) {
// JSONArray datas = new JSONArray();
// RecordSet rs = new RecordSet();
// RecordSet rs1 = new RecordSet();
// String ss = request.getQueryString();
// CustomSearchComInfo customSearchComInfo = new CustomSearchComInfo();
// String defSql = Util.toScreenToEdit(customSearchComInfo.getDefaultSql(customid), user.getLanguage()) ;
//
// Map<String, List<JSONObject>> groupMap=new HashMap<String,List<JSONObject>>();
//
// // 表单字段
// String sql = "SELECT ID,fieldid,customname,fieldhtmltype,typeTemp,fielddbtype,fieldname,orderid,groupid,showmodel FROM (";
// sql += "select quick.ID,bill.id fieldid,quick.customname,bill.fieldhtmltype,bill.type typeTemp,bill.fielddbtype,fieldname,orderid,groupid,showmodel from mode_quicksearch_condition quick left join workflow_billfield bill on bill.id=quick.fieldid where customid=? AND quick.fieldid NOT IN(-1,-2) ";
//
// List args = new ArrayList();
// args.add(customid);
// ModeFormComInfo modeFormComInfo = new ModeFormComInfo();
// String formId = customSearchComInfo.getFormId(customid);
// boolean isVirtualForm = "1".equals(modeFormComInfo.getIsVirtualForm(formId));
// if(!isVirtualForm) {
// // 加入创建日期
// sql += "UNION ALL ";
// sql += "SELECT id,1 fieldid,customname,'3' fieldhtmltype,2 typeTemp, 'char(10)' fielddbtype,'modedatacreatedate' fieldname,orderid,groupid,showmodel ";
// sql += "FROM mode_quicksearch_condition WHERE customid=? AND fieldid =-1 ";
//
// // 加入创建人
// sql += "UNION ALL ";
// //sql += "SELECT id,2 fieldid,customname,'3' fieldhtmltype,1 TYPE, 'int' fielddbtype,'modedatacreater' fieldname,orderid ";
// sql += "SELECT id,2 fieldid,customname,'3' fieldhtmltype,1 typeTemp, 'int' fielddbtype,'modedatacreater' fieldname,orderid,groupid,showmodel ";
// sql += "FROM mode_quicksearch_condition WHERE customid=? AND fieldid =-2 ";
//
// //添加最后修改人
// sql += "UNION ALL ";
// sql += "SELECT id,7 fieldid,customname,'3' fieldhtmltype,1 typeTemp, 'int' fielddbtype,'modedatacreater' fieldname,orderid,groupid,showmodel ";
// sql += "FROM mode_quicksearch_condition WHERE customid=? AND fieldid =-7 ";
//
// //添加最后修改日期时间
// sql += "UNION ALL ";
// sql += "SELECT id,8 fieldid,customname,'3' fieldhtmltype,290 typeTemp, 'char(10)' fielddbtype,'modedatacreatedate' fieldname,orderid,groupid,showmodel ";
// sql += "FROM mode_quicksearch_condition WHERE customid=? AND fieldid =-8 ";
//
// //添加密级字段int
// sql += "UNION ALL ";
// sql += "SELECT id,9 fieldid,customname,'5' fieldhtmltype,2 typeTemp, 'int' fielddbtype,'seclevel' fieldname,orderid,groupid,showmodel ";
// sql += "FROM mode_quicksearch_condition WHERE customid=? AND fieldid =-9 ";
//
// args.add(customid);
// args.add(customid);
// args.add(customid);
// args.add(customid);
// args.add(customid);
// }
//
// // 按照字段排序
// sql += ") a order by groupid asc,orderid asc,id asc";
//
// rs.executeQuery(sql, args);
// while (rs.next()) {
// int viewAttr = 2;
// JSONObject json = new JSONObject();
// String fieldhtmltype = Util.null2String(rs.getString("fieldhtmltype"));
// String fieldtype = Util.null2String(rs.getString("typeTemp"));
// String id = Util.null2String(rs.getString("id"));
// String fieldnames = Util.null2String(rs.getString("fieldname"));
// String fieldid = Util.null2String(rs.getString("fieldid"));
// String groupid = Util.null2String(rs.getString("groupid"));
// float orderid = Util.getFloatValue(Util.null2String(rs.getString("orderid")),0);
// String showmodel = Util.null2String(rs.getString("showmodel"));
// String querysql = "select t.* from mode_CustomDspField t where t.customid=? and t.fieldid=?";
// String conditiontransition = "";
// String searchparavalue = "";
// String searchparavalue1 = "";
// String conditionValue = "";
// String conditionValue1 = "";
// String conditionValue2 = "";
// String fieldname_seclevel = Util.null2String(rs.getString("fieldname"));//用于验证是否是密级字段;
// String showtype = Util.null2o(rs.getString("showtype"));//显示模式主要 针对浏览框 0: 浏览框模式 1: 下拉拉框模式
// rs1.executeQuery(querysql, customid, "1".equals(fieldid)?"-1":"2".equals(fieldid)?"-2":"7".equals(fieldid)?"-7":"8".equals(fieldid)?"-8":fieldid);
// int count = 0;
// String requiredCon = "";
// if(rs1.next()){
// count ++;
// conditiontransition = Util.null2String(rs1.getString("conditiontransition"));
// requiredCon = Util.null2String(rs1.getString("requiredCon"));
// if("1".equals(requiredCon)){
// viewAttr = 3;
// }
// conditionValue = Util.null2String(rs1.getString("conditionValue"));
// conditionValue1 = Util.null2String(rs1.getString("conditionValue1"));
// conditionValue2 = Util.null2String(rs1.getString("conditionValue2"));
// String searchparaname = Util.null2String(rs1.getString("searchparaname"));
// String searchparaname1 = Util.null2String(rs1.getString("searchparaname1"));
// if(!StringHelper.isEmpty(searchparaname)) {
// searchparavalue = replaceParams(Util.null2String(request.getParameter(searchparaname)), user);
// }
//
// if(!StringHelper.isEmpty(searchparaname1)) {
// searchparavalue1 = replaceParams(Util.null2String(request.getParameter(searchparaname1)), user);
// }
// if("".equals(searchparavalue)){
// if("3".equals(fieldhtmltype)&&"1".equals(fieldtype)){ //人力资源
// if(!"".equals(conditionValue1)&&!"null".equals(conditionValue1)){
// searchparavalue = conditionValue1;
// }else if(conditiontransition.equalsIgnoreCase("1") && "".equals(conditionValue1)&&!"-5".equals(conditionValue)){
// searchparavalue = conditionValue;
// }else{
// searchparavalue = conditionValue;
// }
// }else if ("3".equals(fieldhtmltype)&&("2".equals(fieldtype)||"19".equals(fieldtype)||"290".equals(fieldtype))){
// if("3".equals(fieldhtmltype)&&"19".equals(fieldtype)){ //时间
// if("".equals(conditionValue)&&"".equals(conditionValue1)){
// searchparavalue = searchparavalue;
// }else{
// searchparavalue = conditionValue+","+conditionValue1;
// }
// }else if("3".equals(fieldhtmltype)&&"2".equals(fieldtype)){ //日期
// if("".equals(conditionValue)&&"".equals(conditionValue1)){
// searchparavalue = searchparavalue;
// }else{
// searchparavalue = conditionValue+","+conditionValue1;
// }
// }else if(!"".equals(conditionValue1)&&!"null".equals(conditionValue1)){
// if(!"".equals(conditionValue1)&&!"null".equals(conditionValue1)){
// searchparavalue = conditionValue1+","+conditionValue2; //处理时间,日期回显
//// searchparavalue1 = conditionValue1;
// }else{
// searchparavalue = conditionValue;
// }
// }
// }else{
// String acValue = conditionValue;
// if(!"".equals(conditionValue1)&&!"null".equals(conditionValue1)){
// if(!"".equals(conditionValue2)&&!"null".equals(conditionValue2)){
// conditionValue = conditionValue+","+conditionValue1+","+conditionValue2;
// }else{
// conditionValue = conditionValue+","+conditionValue1;
// }
// }
// if(!"".equals(conditionValue)){
// searchparavalue = conditionValue;
// }
// if("1".equals(fieldhtmltype)&&!"1".equals(fieldtype)){
// searchparavalue = acValue;
// }
// }
// }
// }
// if(conditiontransition.equalsIgnoreCase("1") && fieldhtmltype.equals("3")){
// fieldtype = convertSingleBrowserTypeToMulti_All(fieldtype);
// }
// String fielddbtype = Util.null2String(rs.getString("fielddbtype"));
// if ("".equals(fieldid)) {
// continue;
// }
//
// String fieldname = "con_"+ (Util.getIntValue(fieldid) > 0 ? fieldid : "_"+(-Util.getIntValue(fieldid)));
// if(StringHelper.isEmpty(searchparavalue)&&StringHelper.isEmpty(searchparavalue1)){//con_fielid格式作为查询条件, 解析到查询条件上
// searchparavalue=Util.null2String(request.getParameter(fieldname));
// }
//
//
// String customname = Util.null2String(rs.getString("customname"));
// customname=Util.formatMultiLang(customname, user.getLanguage()+"");
// if ("1".equals(fieldhtmltype)) {
// if ("1".equals(fieldtype)) {//单行文本
// if(!searchparavalue.isEmpty()) {
// json.put("value", searchparavalue);
// }
// }else {//整数或浮点数
// sql ="select id,customname,minnum,maxnum from mode_quicksearch_detail where cid=? order by orderid asc,id asc";
// rs1.executeQuery(sql, id);
// JSONArray arr = new JSONArray();
// JSONObject obj1 = new JSONObject();
// if("1".equals(requiredCon)){
// obj1.put("key", "");
// }else{
// obj1.put("key", "-1");
// }
// obj1.put("showname", "");
// arr.add(obj1);
// boolean flg = false;
// Map<String,String> map = new HashMap<String,String>();
// while (rs1.next()) {
// String minnum = Util.null2String(rs1.getString("minnum"));
// String maxnum = Util.null2String(rs1.getString("maxnum"));
// String fieldValue = minnum+","+maxnum;
// map.put(rs1.getString("id"),fieldValue);
// boolean flgs = false;
// if (!"".equals(minnum) && !searchparavalue.isEmpty()) {
// float num = Util.getFloatValue(minnum);
// float num2 = Util.getFloatValue(maxnum);
// if(Util.getFloatValue(searchparavalue)==Util.getFloatValue("0")){
// if(num<=Util.getFloatValue(searchparavalue) && num2>=Util.getFloatValue(searchparavalue) && !flg){
// flg = true;
// flgs = true;
// //json.put("value", rs1.getString("id"));
// }
// }else{
// if(num<=Util.getFloatValue(searchparavalue) && num2>=Util.getFloatValue(searchparavalue) && !flg){
// flg = true;
// flgs = true;
// //json.put("value", rs1.getString("id"));
// }
// }
// }
// JSONObject obj2 = new JSONObject();
// obj2.put("key",rs1.getString("id"));
// obj2.put("selected",flgs);
// obj2.put("showname", Util.formatMultiLang(rs1.getString("customname"), user.getLanguage()+""));
// arr.add(obj2);
// }
// json.put("floatValue",map);
// json.put("options", arr);
// }
// } else if ("2".equals(fieldhtmltype)) {//多文本
// if(!searchparavalue.isEmpty()) {
// json.put("value", searchparavalue);
// }
// }else if ("5".equals(fieldhtmltype) && "1".equals(fieldtype)) {//选择框
// RecordSet record = new RecordSet();
// StringBuffer sql1 = new StringBuffer();
// Integer fieldlabel = 0;
// String parentDomkey = "";
// Integer pubchilchoiceId = 0;
//
// sql1.append(" select a.id, b.fieldlabel, b.pubchilchoiceId ");
// sql1.append(" from mode_customdspfield a, workflow_billfield b ");
// sql1.append(" where a.fieldid = b.id and b.id=? ");
// sql1.append(" and a.customId = ? ");
// record.executeQuery(sql1.toString(),fieldid,customId);
// while(record.next()){
// fieldlabel = record.getInt("fieldlabel");
// pubchilchoiceId = record.getInt("pubchilchoiceId");
// }
// if(pubchilchoiceId > 0){
// parentDomkey = "con_"+pubchilchoiceId;
// }else{//#866910
// String dlxzksql = "select t.id from workflow_billfield t where t.childfieldid=?";
// rs1.executeQuery(dlxzksql,fieldid);
// if(rs1.next()){
// String parentfieldid = Util.null2String(rs1.getString(1));
// if(!parentfieldid.isEmpty()){
// parentDomkey = "con_"+parentfieldid;
// }
// }
// }
// ConditionFactory conditionFactory = new ConditionFactory(user);
// CubeFieldService cfs = new CubeFieldService();
// List<SearchConditionOption> options = new ArrayList<SearchConditionOption>();
// SearchConditionItem conditionJson = new SearchConditionItem();
// if(!"seclevel".equals(fieldname_seclevel)){
// conditionJson = conditionFactory.createCondition(ConditionType.SELECT, fieldlabel, fieldname+","+parentDomkey, cfs.getWorkflowSelectItems(""+fieldid, user.getLanguage(),true));
// //options = cfs.getWorkflowSelectItems(""+fieldid, user.getLanguage(),true);
// options = conditionJson.getOptions();
// if("1".equals(conditiontransition) && options.size()>0&&"".equals(options.get(0).getKey())){//选择框多选时去除空选项
// options.remove(0);
// }
// }else{
// //密级修改为从人力资源那么获取
// Map<String,Object> otherParam = new HashMap<>();
// AddSeclevelUtil addSeclevelUtil = new AddSeclevelUtil();
// otherParam.put("fieldlabel",fieldlabel);
// otherParam.put("fieldname",fieldname);
// otherParam.put("parentDomkey",parentDomkey);
// conditionJson = addSeclevelUtil.getSecLevelOptions(conditionFactory,user,otherParam);
//
//// HrmClassifiedProtectionBiz hrmClassifiedProtectionBiz = new HrmClassifiedProtectionBiz();
//// SearchConditionOption searchConditionOption = new SearchConditionOption();
//// searchConditionOption.setKey("");
//// searchConditionOption.setShowname("");
//// searchConditionOption.setChilditemid(Util.splitString("", ","));
//// options.add(searchConditionOption);
//// //密级调用人力资源的 资源密级下拉选项
//// List<SearchConditionOption> comOptions = hrmClassifiedProtectionBiz.getResourceOptionListByUser(user);
//// if (null != comOptions && comOptions.size() > 0) {
//// for (SearchConditionOption searchConditionOptioninner : comOptions) {
//// SearchConditionOption searchConditionOption_inner = new SearchConditionOption();
//// String selectvalue = searchConditionOptioninner.getKey();
//// String selectname = searchConditionOptioninner.getShowname();
//// searchConditionOption_inner.setKey(selectvalue);
//// searchConditionOption_inner.setShowname(selectname);
//// searchConditionOption_inner.setChilditemid(Util.splitString("", ","));
//// options.add(searchConditionOption_inner);
////
//// }
//// conditionJson = conditionFactory.createCondition(ConditionType.SELECT, fieldlabel, fieldname + "," + parentDomkey, options);
//// }
// options = conditionJson.getOptions();
// if("1".equals(conditiontransition) && options.size()>0&&"".equals(options.get(0).getKey())){//选择框多选时去除空选项
// options.remove(0);
// }
// }
//
//
//
// json.put("options", options);
// json.put("parentDomkey",conditionJson.getParentDomkey());
// json.put("domkey",conditionJson.getDomkey());
// if(!searchparavalue.isEmpty()) {
// json.put("value", searchparavalue);
// }
// if(conditiontransition.equalsIgnoreCase("1")){
// json.put("detailtype","2");
// json.put("multiple",true);
// }else{
// json.put("detailtype","");
// }
// json.put("fieldid", fieldid);
// json.put("customname", customname);
// }else if ("5".equals(fieldhtmltype) && "2".equals(fieldtype)) {//多选
// RecordSet record = new RecordSet();
// StringBuffer sql1 = new StringBuffer();
// Integer fieldlabel = 0;
// String parentDomkey = "";
// Integer pubchilchoiceId = 0;
//
// sql1.append(" select a.id, b.fieldlabel,b.pubchilchoiceId ");
// sql1.append(" from mode_customdspfield a, workflow_billfield b ");
// sql1.append(" where a.fieldid = b.id and b.id=? ");
// sql1.append(" and a.customId = ? ");
// record.executeQuery(sql1.toString(),fieldid,customId);
// while(record.next()){
// fieldlabel = record.getInt("fieldlabel");
// pubchilchoiceId = record.getInt("pubchilchoiceId");
// }
// if(pubchilchoiceId > 0){
// parentDomkey = "con_"+pubchilchoiceId;
// }else{//#866910
// String dlxzksql = "select t.id from workflow_billfield t where t.childfieldid=?";
// rs1.executeQuery(dlxzksql,fieldid);
// if(rs1.next()){
// String parentfieldid = Util.null2String(rs1.getString(1));
// if(!parentfieldid.isEmpty()){
// parentDomkey = "con_"+parentfieldid;
// }
// }
// }
// ConditionFactory conditionFactory = new ConditionFactory(user);
// CubeFieldService cfs = new CubeFieldService();
// SearchConditionItem conditionJson = new SearchConditionItem();
// if(!"seclevel".equals(fieldname_seclevel)){
// conditionJson = conditionFactory.createCondition(ConditionType.SELECT, fieldlabel, fieldname+","+parentDomkey,cfs.getWorkflowSelectItems(""+fieldid, user.getLanguage(),true));
// }else{
// //密级修改为从人力资源那么获取
// Map<String,Object> otherParam = new HashMap<>();
// AddSeclevelUtil addSeclevelUtil = new AddSeclevelUtil();
// otherParam.put("fieldlabel",fieldlabel);
// otherParam.put("fieldname",fieldname);
// otherParam.put("parentDomkey",parentDomkey);
// conditionJson = addSeclevelUtil.getSecLevelOptions(conditionFactory,user,otherParam);
//
// }
// List<SearchConditionOption> options = new ArrayList<SearchConditionOption>();
// options = conditionJson.getOptions();
// if(!searchparavalue.isEmpty()) {
// json.put("value", searchparavalue);
// }
// json.put("options", options);
// json.put("parentDomkey",conditionJson.getParentDomkey());
// json.put("domkey",conditionJson.getDomkey());
// json.put("viewAttr", viewAttr);
// json.put("detailtype","2");
// json.put("customname", customname);
// }else if ("5".equals(fieldhtmltype) && "3".equals(fieldtype)) {//单选
// RecordSet record = new RecordSet();
// StringBuffer sql1 = new StringBuffer();
// Integer fieldlabel = 0;
// String parentDomkey = "";
// Integer pubchilchoiceId = 0;
//
// sql1.append(" select a.id, b.fieldlabel, b.pubchilchoiceId ");
// sql1.append(" from mode_customdspfield a, workflow_billfield b ");
// sql1.append(" where a.fieldid = b.id and b.id=? ");
// sql1.append(" and a.customId = ? ");
// record.executeQuery(sql1.toString(),fieldid,customId);
// while(record.next()){
// fieldlabel = record.getInt("fieldlabel");
// pubchilchoiceId = record.getInt("pubchilchoiceId");
// }
// if(pubchilchoiceId > 0){
// parentDomkey = "con_"+pubchilchoiceId;
// }else{//#866910
// String dlxzksql = "select t.id from workflow_billfield t where t.childfieldid=?";
// rs1.executeQuery(dlxzksql,fieldid);
// if(rs1.next()){
// String parentfieldid = Util.null2String(rs1.getString(1));
// if(!parentfieldid.isEmpty()){
// parentDomkey = "con_"+parentfieldid;
// }
// }
// }
// ConditionFactory conditionFactory = new ConditionFactory(user);
// CubeFieldService cfs = new CubeFieldService();
// SearchConditionItem conditionJson = conditionFactory.createCondition(ConditionType.SELECT, fieldlabel, fieldname+","+parentDomkey,cfs.getWorkflowSelectItems(""+fieldid, user.getLanguage(),true));
// List<SearchConditionOption> options = new ArrayList<SearchConditionOption>();
// options = conditionJson.getOptions();
// if("1".equals(conditiontransition) && options.size()>0&&"".equals(options.get(0).getKey())){//选择框多选时去除空选项
// options.remove(0);
// }
// json.put("options", options);
// if(!searchparavalue.isEmpty()) {
// json.put("value", searchparavalue);
// }
// json.put("detailtype","3");
// json.put("parentDomkey",conditionJson.getParentDomkey());
// json.put("domkey",conditionJson.getDomkey());
// json.put("supportCancel", true);
// json.put("fieldid", fieldid);
// json.put("customname", customname);
// }else if ("4".equals(fieldhtmltype) && "1".equals(fieldtype)) {//勾选框
// RecordSet record = new RecordSet();
// StringBuffer sql1 = new StringBuffer();
// Integer fieldlabel = 0;
//
// sql1.append(" select a.id, b.fieldlabel ");
// sql1.append(" from mode_customdspfield a, workflow_billfield b ");
// sql1.append(" where a.fieldid = b.id and b.id=? ");
// sql1.append(" and a.customId = ? ");
// record.executeQuery(sql1.toString(),fieldid,customId);
// while(record.next()){
// fieldlabel = record.getInt("fieldlabel");
// }
// ConditionFactory conditionFactory = new ConditionFactory(user);
// CubeFieldService cfs = new CubeFieldService();
// SearchConditionItem conditionJson = conditionFactory.createCondition(ConditionType.SELECT, fieldlabel, fieldname,this.getCheckOptions(user.getLanguage()));
// List<SearchConditionOption> options = new ArrayList<SearchConditionOption>();
// options = conditionJson.getOptions();
//
// json.put("options", options);
// json.put("domkey",conditionJson.getDomkey());
// json.put("viewAttr", viewAttr);
// json.put("detailtype","3");
// json.put("customname", customname);
// }else if ("3".equals(fieldhtmltype)) {//日期
// BrowserBean browserProps = null;
// if ("2".equals(fieldtype)||"19".equals(fieldtype)||"290".equals(fieldtype)) {//日期 时间 日期时间
// if(searchparavalue.indexOf(",")>-1){
// String[] vals = searchparavalue.split(",");
// if(vals.length>0){
// searchparavalue = vals[0];
// if(vals.length>1){
// searchparavalue1 = vals[1];
// if(vals.length>2){
// searchparavalue1 = vals[1]+vals[2];
// }
// }
// }
// }
// if("2".equals(fieldtype) && searchparavalue.isEmpty()){
// searchparavalue = "0"; // 全部
// }
// if("2".equals(fieldtype) && !searchparavalue.isEmpty()) {
// if(-1!=Util.getIntValue(searchparavalue)){
// json.put("value", new String[]{searchparavalue,"",""});
// }else{
// json.put("value", new String[]{"6",searchparavalue,searchparavalue1});
// }
// }else{
// ArrayList<String> dataValue = new ArrayList<String>();
// if("".equals(searchparavalue)&&"".equals(searchparavalue1)){
// json.put("value", dataValue);
// }else{
// dataValue.add(searchparavalue);
// dataValue.add(searchparavalue1);
// json.put("value", dataValue);
// }
//// json.put("value", searchparavalue);
// }
// }else if("402".equals(fieldtype) || "403".equals(fieldtype)){//年、年月
// if(!searchparavalue.isEmpty()) {
// json.put("value", searchparavalue);
// }
// }else if("161".equals(fieldtype) || "162".equals(fieldtype)) {
// browserProps = new BrowserBean(fieldtype);
// BrowserValueInfoService browserValueInfoService = new BrowserValueInfoService();
// List <Object> valueObj = null;
// List<Map<String,Object>> replaceDatas = new ArrayList<Map<String,Object>>();
// try {
// valueObj = browserValueInfoService.getBrowserValueInfo(Util.getIntValue(fieldtype), fielddbtype, 0, searchparavalue, user.getLanguage(), -1);
// for(int i=0;i<valueObj.size();i++){
// Map<String,Object> map = new HashMap<String,Object>();
// BrowserValueInfo m=(BrowserValueInfo)valueObj.get(i);
// map.put("id",m.getId());
// map.put("name",m.getName());
// map.put("count",m.getCount());
// replaceDatas.add(map);
// }
// json.put("replaceDatas",replaceDatas);
// browserProps.setReplaceDatas(replaceDatas);
//
// } catch (Exception e) {
// }
// new BrowserInitUtil().initCustomizeBrow(browserProps,fielddbtype, Util.getIntValue(fieldtype) , user.getUID());
// browserProps.getDataParams().put("formmodefieldid",fieldid);
// browserProps.getConditionDataParams().put("formmodefieldid", fieldid);
// browserProps.getCompleteParams().put("formmodefieldid", fieldid);
// } else if("256".equals(fieldtype) || "257".equals(fieldtype)) {
// browserProps = new BrowserBean(fieldtype);
// browserProps.getDataParams().put("cube_treeid", fielddbtype);
// browserProps.getCompleteParams().put("cube_treeid", fielddbtype);
// BrowserValueInfoService browserValueInfoService = new BrowserValueInfoService();
// List <Object> valueObj = null;
// List<Map<String,Object>> replaceDatas = new ArrayList<Map<String,Object>>();
// try {
// valueObj = browserValueInfoService.getBrowserValueInfo(Util.getIntValue(fieldtype), fielddbtype, 0, searchparavalue, user.getLanguage(), -1);
// for(int i=0;i<valueObj.size();i++){
// Map<String,Object> map = new HashMap<String,Object>();
// BrowserValueInfo m=(BrowserValueInfo)valueObj.get(i);
// map.put("id",m.getId());
// map.put("name",m.getName());
// map.put("count",m.getCount());
// replaceDatas.add(map);
// }
// json.put("replaceDatas",replaceDatas);
// browserProps.setReplaceDatas(replaceDatas);
//
// } catch (Exception e) {
// }
// new BrowserInitUtil().initBrowser(browserProps,user.getLanguage());
// }else if("1".equals(fieldtype)||("1".equals(conditiontransition)&&"17".equals(fieldtype))){ //人力资源
// if("1".equals(conditiontransition)&&"1".equals(fieldtype)){
// browserProps = new BrowserBean(fieldtype);
// browserProps.setViewAttr(viewAttr);
// List<Object> objs = null;
// if(!searchparavalue.isEmpty()){
// if (Util.getIntValue(searchparavalue) == 0||"-1".equals(searchparavalue)||Util.getIntValue(searchparavalue) == -2
// ||Util.getIntValue(searchparavalue) == -3||Util.getIntValue(searchparavalue) == -4||Util.getIntValue(searchparavalue) == -5
// ||Util.getIntValue(searchparavalue) == -6||Util.getIntValue(searchparavalue) == -7||Util.getIntValue(searchparavalue) == -8){
// json.put("value",new String[]{searchparavalue,"",""});
// } else {
// try {
// objs = new BrowserValueInfoService().getBrowserValueInfo(1,null,0,searchparavalue,user.getLanguage(),-1);
// } catch (Exception e) {
// }
// String valueSpan = "";
// if(objs!=null) {
// for(Object obj : objs) {
// valueSpan+=((BrowserValueInfo) obj).getName()+",";
// }
// valueSpan = valueSpan.substring(0,valueSpan.length()-1);
// }
// json.put("value", new Object[]{"-5",new Object[]{searchparavalue,valueSpan, objs}});
// }
// }else{
// json.put("value", new Object[]{"-5","",""});
// }
// new BrowserInitUtil().initBrowser(browserProps,user.getLanguage());
// }else{
// browserProps = new BrowserBean(fieldtype);
// browserProps.setViewAttr(viewAttr);
// List<Object> objs = null;
// if(!searchparavalue.isEmpty()){
// if (Util.getIntValue(searchparavalue) <= 0){
// json.put("value",new String[]{searchparavalue,""});
// } else {
// try {
// objs = new BrowserValueInfoService().getBrowserValueInfo(1,null,0,searchparavalue,user.getLanguage(),-1);
// } catch (Exception e) {
// }
// String valueSpan = "";
// if(objs!=null) {
// for(Object obj : objs) {
// valueSpan+=((BrowserValueInfo) obj).getName()+",";
// }
// }
// json.put("value", new Object[]{"-5",new Object[]{searchparavalue,valueSpan, objs}});
// }
// }else{
// json.put("value", new Object[]{"-5","",""});
// }
// new BrowserInitUtil().initBrowser(browserProps,user.getLanguage());
// }
// }else if("4".equals(fieldtype) || "57".equals(fieldtype)){
// browserProps = new BrowserBean(fieldtype);
// if(!searchparavalue.isEmpty()){
// BrowserValueInfoService browserValueInfoService = new BrowserValueInfoService();
// List <BrowserValueInfo> valueObj = null;
// List<Map<String,Object>> replaceDatas = new ArrayList<Map<String,Object>>();
// try {
// valueObj = browserValueInfoService.getBrowserValueInfo(fieldtype, String.valueOf(fielddbtype), 0, searchparavalue, user.getLanguage(), "","");
// for(int i=0;i<valueObj.size();i++){
// Map<String,Object> map = new HashMap<String,Object>();
// BrowserValueInfo m=(BrowserValueInfo)valueObj.get(i);
// map.put("id",m.getId());
// map.put("name",m.getName());
// map.put("count",m.getCount());
// replaceDatas.add(map);
// }
// json.put("replaceDatas",replaceDatas);
// browserProps.setReplaceDatas(replaceDatas);
// } catch (Exception e) {
// }
// }
// browserProps.setViewAttr(viewAttr);
// Map<String,Object> map = new HashMap<String,Object>();
// Map<String,Object> map1 = new HashMap<String,Object>();
// Map<String,Object> map2 = new HashMap<String,Object>();
// map.put("fromModule","model");
// map1.put("fromModule","model");
// map2.put("fromModule","model");
// browserProps.setDataParams(map1);
// browserProps.setDestDataParams(map2);
// browserProps.setCompleteParams(map);
// new BrowserInitUtil().initBrowser(browserProps,user.getLanguage());
// } else if("164".equals(fieldtype)||"194".equals(fieldtype)){
// browserProps = new BrowserBean(fieldtype);
// if(!searchparavalue.isEmpty()){
// BrowserValueInfoService browserValueInfoService = new BrowserValueInfoService();
// List <BrowserValueInfo> valueObj = null;
// List<Map<String,Object>> replaceDatas = new ArrayList<Map<String,Object>>();
// try {
// valueObj = browserValueInfoService.getBrowserValueInfo(fieldtype, String.valueOf(fielddbtype), 0, searchparavalue, user.getLanguage(), "","");
// for(int i=0;i<valueObj.size();i++){
// Map<String,Object> map = new HashMap<String,Object>();
// BrowserValueInfo m=(BrowserValueInfo)valueObj.get(i);
// map.put("id",m.getId());
// map.put("name",m.getName());
// map.put("count",m.getCount());
// replaceDatas.add(map);
// }
// json.put("replaceDatas",replaceDatas);
// browserProps.setReplaceDatas(replaceDatas);
// } catch (Exception e) {
// }
// }
// browserProps.setViewAttr(viewAttr);
// Map<String,Object> map = new HashMap<String,Object>();
// Map<String,Object> map1 = new HashMap<String,Object>();
// Map<String,Object> map2 = new HashMap<String,Object>();
// map.put("fromModule","model");
// map1.put("fromModule","model");
// map2.put("fromModule","model");
// browserProps.setDataParams(map1);
// browserProps.setDestDataParams(map2);
// browserProps.setCompleteParams(map);
// new BrowserInitUtil().initBrowser(browserProps,user.getLanguage());
// } else {
// browserProps = new BrowserBean(fieldtype);
// if(!searchparavalue.isEmpty()){
// BrowserValueInfoService browserValueInfoService = new BrowserValueInfoService();
// List <Object> valueObj = null;
// List<Map<String,Object>> replaceDatas = new ArrayList<Map<String,Object>>();
// try {
// valueObj = browserValueInfoService.getBrowserValueInfo(Util.getIntValue(fieldtype), fielddbtype, 0, searchparavalue, user.getLanguage(), -1);
// for(int i=0;i<valueObj.size();i++){
// Map<String,Object> map = new HashMap<String,Object>();
// if("141".equals(fieldtype)){
// map = (Map<String,Object>)valueObj.get(i);
// }else {
// BrowserValueInfo m=(BrowserValueInfo)valueObj.get(i);
// map.put("id", m.getId());
// map.put("name", m.getName());
// map.put("count", m.getCount());
// }
// replaceDatas.add(map);
// }
// json.put("replaceDatas",replaceDatas);
// browserProps.setReplaceDatas(replaceDatas);
//
// } catch (Exception e) {
// }
// }
// //Map<String,Object> map = new HashMap<>();
// //map.put("fromModule","model");
// //browserProps.setDataParams(map);
// //browserProps.setDestDataParams(map);
// //browserProps.setCompleteParams(map);
// browserProps.setViewAttr(viewAttr);
// new BrowserInitUtil().initBrowser(browserProps,user.getLanguage());
// }
// if(conditiontransition.equalsIgnoreCase("1")){
// // browserProps.setIsMultCheckbox(true);
// browserProps.setType(fieldtype);
// }
//
// json.put("browserProps", browserProps);
// }
// json.put("conditiontransition",conditiontransition);
// json.put("fieldid", fieldid);
// json.put("customname", customname);
// json.put("fieldtype", fieldtype);
// json.put("viewAttr",viewAttr);
// json.put("requiredCon",requiredCon);
// json.put("fieldhtmltype", fieldhtmltype);
// json.put("showtype",showtype );//显示模式主要 针对浏览框 0: 浏览框模式 1: 下拉拉框模式
// json.put("groupid",groupid );
// json.put("showmodel",showmodel );
// json.put("orderid",orderid );
// if(!"".equals(groupid) && !"0".equals(groupid)){
// List<JSONObject> list=groupMap.get(groupid);
// if(null==list){
// list=new ArrayList<JSONObject>();
// }
// list.add(json);
// groupMap.put(groupid,list);
// }else{
// datas.add(json);
// }
// }
//
// rs.executeQuery("select * from mode_customsearchgroup where customid=?",customid);
// Map<String,String> group=new HashMap<String,String>();
// while(rs.next()){
// float minOrder = 10000000;
// JSONObject json = new JSONObject();
// String id=Util.null2String(rs.getString("id"));
// String groupname=Util.null2String(rs.getString("groupname"));
// List<JSONObject> list=groupMap.get(id);//当前分组下的所有快捷搜索
// if(null==list) {
// continue;
// }
//
// json.put("groupid",id);
// json.put("groupname",groupname);
// JSONArray chrild = new JSONArray();
// for(int i=0;i<list.size();i++){
// float childorderid = Util.getFloatValue(Util.null2String(list.get(i).get("orderid")),0);
// //取分组里orderid最小的一个分组的orderid
// if(childorderid<minOrder){
// minOrder = childorderid;
// }
// chrild.add(list.get(i));
// }
// json.put("orderid",minOrder);
// json.put("searchGroup",chrild);
// datas.add(json);
// }
//
// return datas;
// }
private String replaceParams ( String value , User user ) {
if ( "$date$" . equalsIgnoreCase ( value ) ) {
return "1" ;
} else if ( "$ThisWeek$" . equalsIgnoreCase ( value ) ) {
return "2" ;
} else if ( "$ThisMonth$" . equalsIgnoreCase ( value ) ) {
return "3" ;
} else if ( "$ThisSeason$" . equalsIgnoreCase ( value ) ) {
return "4" ;
} else if ( "$ThisYear$" . equalsIgnoreCase ( value ) ) {
return "5" ;
} else if ( "$LastMonth$" . equalsIgnoreCase ( value ) ) {
return "7" ;
} else if ( "$LastYear$" . equalsIgnoreCase ( value ) ) {
return "8" ;
} else if ( "$UserId$" . equalsIgnoreCase ( value ) ) {
return "" + user . getUID ( ) ;
} else if ( "$DepartmentId$" . equalsIgnoreCase ( value ) ) {
try {
ResourceComInfo resourceComInfo = new ResourceComInfo ( ) ;
return resourceComInfo . getDepartmentID ( "" + user . getUID ( ) ) ;
} catch ( Exception e ) {
/ * *
* 获 取 人 员 自 定 义 选 择 字 段 , 所 有 选 择 选 项
*
* @param quickSearchCondition 快 速 搜 索 条 件
* @return 选 择 字 段 , 所 有 选 项 列 表
* /
private List < SearchConditionOption > getSelectOptions ( QuickSearchCondition quickSearchCondition ) {
try {
String fieldId = quickSearchCondition . getFieldId ( ) ;
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo ( ) ;
int scopeid = Integer . parseInt ( fieldId . split ( "_" ) [ 0 ] ) ;
HrmFieldManager hfm = new HrmFieldManager ( "HrmCustomFieldByInfoType" , scopeid ) ;
String fieldName = fieldId . substring ( fieldId . lastIndexOf ( "_" ) + 1 ) ;
org . json . JSONObject hrmFieldConf = hfm . getHrmFieldConf ( fieldName ) ;
if ( null = = hrmFieldConf ) {
return new ArrayList < > ( ) ;
}
} else if ( "$SubcompanyId$" . equalsIgnoreCase ( value ) ) {
try {
ResourceComInfo resourceComInfo = new ResourceComInfo ( ) ;
return resourceComInfo . getSubCompanyID ( "" + user . getUID ( ) ) ;
} catch ( Exception e ) {
boolean baseField = hfm . isBaseField ( fieldName ) ;
HrmFieldBean hrmFieldBean = new HrmFieldBean ( ) ;
hrmFieldBean . setFieldid ( Util . null2String ( hrmFieldConf . getString ( "id" ) ) ) ;
hrmFieldBean . setFieldname ( scopeid + "_" + ( baseField ? "hrm" : "cus" ) + "_" + fieldName ) ;
hrmFieldBean . setFieldlabel ( hrmFieldConf . getString ( "fieldlabel" ) ) ;
hrmFieldBean . setFieldhtmltype ( hrmFieldConf . getString ( "fieldhtmltype" ) ) ;
hrmFieldBean . setType ( hrmFieldConf . getString ( "type" ) ) ;
hrmFieldBean . setDmlurl ( hrmFieldConf . getString ( "dmlurl" ) ) ;
hrmFieldBean . setIssystem ( baseField ? "1" : "0" ) ;
hrmFieldBean . setIsFormField ( true ) ;
hrmFieldBean . setIsQuickSearch ( false ) ;
hrmFieldBean . setIsScope ( false ) ;
if ( "jobactivity" . equals ( fieldName ) ) {
// 职务: 282
hrmFieldBean . setType ( "282" ) ;
}
} else if ( "$yesterday$" . equalsIgnoreCase ( value ) ) {
return "9" ;
} else if ( "$tomorrow$" . equalsIgnoreCase ( value ) ) {
return "10" ;
} else if ( "$lastWeek$" . equalsIgnoreCase ( value ) ) {
return "11" ;
} else if ( "$nextWeek$" . equalsIgnoreCase ( value ) ) {
return "12" ;
SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo . getSearchConditionItem ( hrmFieldBean , user ) ;
return searchConditionItem . getOptions ( ) ;
} catch ( JSONException e ) {
throw new RuntimeException ( e ) ;
}
return value ;
}
public static String convertSingleBrowserTypeToMulti_All ( String fieldtype ) {
switch ( fieldtype ) {
// case "1":return "17";//人力资源
case "7" :
return "18" ; //多客户
case "9" :
return "37" ; //多文档
// case "4":return "57";//多部门
case "267" :
return "65" ; //多角色
case "8" :
return "135" ; //多项目
case "16" :
return "152" ; //多流程
case "161" :
return "162" ; //自定义多选
case "165" :
return "166" ; //分权多人力资源
case "167" :
return "168" ; //分权多部门
case "169" :
return "170" ; //分权多分部
// case "164":return "194";//多分部
case "256" :
return "257" ; //自定义树形多选
case "24" :
return "278" ; //多岗位
case "292" :
return "293" ; //多发票
case "87" :
return "184" ; //会议室
case "23" :
return "315" ; //多资产
case "25" :
return "317" ; //多资产组
case "179" :
return "314" ; //多资产资料
default :
return fieldtype ;
}
}
}