package com.engine.organization.service.impl; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.cloudstore.dev.api.util.TextUtil; import com.engine.core.impl.Service; import com.engine.organization.entity.search.*; import com.engine.organization.mapper.condition.QuickSearchMapper; 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 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.systeminfo.SystemEnv; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** * @author:dxfeng * @createTime: 2023/08/08 * @version: 1.0 */ public class QuickSearchServiceImpl extends Service implements QuickSearchService { private QuickSearchMapper getQuickSearchMapper() { return MapperProxyFactory.getProxy(QuickSearchMapper.class); } @Override public Map saveQuickSearchCondition(Map params) { return null; } @Override public Map getQuickSearchInfo(Map params) { Map apiDatas = new HashMap<>(16); //开关查询 QuickSearchSetting quickSearchSetting = getQuickSearchMapper().getQuickSearchSetting(user.getUID()); JSONObject json = new JSONObject(); if (null != quickSearchSetting) { json.put("isquicksearch", Util.null2String(quickSearchSetting.getIsQuickSearch())); json.put("isshowtype", null != quickSearchSetting.getIsShowType() ? quickSearchSetting.getIsShowType() : "1"); json.put("ishidename", null != quickSearchSetting.getIsHideName() ? quickSearchSetting.getIsHideName() : "0"); json.put("id", Util.null2String(quickSearchSetting.getId())); } else { json.put("isquicksearch", "0"); json.put("isshowtype", "0"); json.put("ishidename", "0"); json.put("id", "0"); } apiDatas.put("setting", json); //条件字段查询 List quickSearchConditionList = getQuickSearchMapper().getQuickSearchConditionList(user.getUID()); JSONArray datas = new JSONArray(); if (CollectionUtils.isNotEmpty(quickSearchConditionList)) { for (QuickSearchCondition quickSearchCondition : quickSearchConditionList) { JSONObject obj = new JSONObject(); String id = Util.null2String(quickSearchCondition.getId()); String fieldId = Util.null2String(quickSearchCondition.getFieldId()); String customName = Util.null2String(quickSearchCondition.getCustomName()); String type = Util.null2String(quickSearchCondition.getType()); String orderId = Util.null2String(quickSearchCondition.getOrderId()); String showModel = null != quickSearchCondition.getShowModel() ? quickSearchCondition.getShowModel().toString() : "0"; obj.put("cid", id); obj.put("key", id); obj.put("fieldid", fieldId); obj.put("orifieldid", fieldId); obj.put("customname", TextUtil.toBase64ForMultilang(customName)); obj.put("type", type); obj.put("orderid", orderId); obj.put("groupid", ""); obj.put("showmodel", showModel); datas.add(obj); } } apiDatas.put("datas", datas); //字段下拉框查询 List quickSearchOptionList = getQuickSearchMapper().getQuickSearchOptionList(); JSONArray options = new JSONArray(); if (CollectionUtils.isNotEmpty(quickSearchOptionList)) { for (QuickSearchOption quickSearchOption : quickSearchOptionList) { JSONObject obj = new JSONObject(); String fieldHtmlType = Util.null2String(quickSearchOption.getFieldHtmlType()); String fieldId = Util.null2String(quickSearchOption.getFieldId()); // 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 fieldType = "2"; boolean isShowModel = false; if ("1".equals(fieldHtmlType)) { if ("1".equals(type)) { //单行文本 fieldType = "5"; } else { //整数或浮点数 fieldType = "1"; isShowModel = true; } } else if ("2".equals(fieldHtmlType) && "1".equals(type)) { //多行文本 fieldType = "5"; } else if ("2".equals(fieldHtmlType) && "2".equals(type)) { //多行文本html fieldType = "5"; } else if ("5".equals(fieldHtmlType) && "3".equals(type)) { //选择框单选框 fieldType = "5"; isShowModel = true; } else if ("5".equals(fieldHtmlType) && "2".equals(type)) { //选择框多选框 fieldType = "5"; isShowModel = true; } else if ("5".equals(fieldHtmlType) && "1".equals(type)) { //选择框 fieldType = "5"; isShowModel = true; } else if ("4".equals(fieldHtmlType) && "1".equals(type)) { //check框 fieldType = "5"; isShowModel = true; } else if ("3".equals(fieldHtmlType)) { switch (type) { case "2": //日期 fieldType = "3"; break; case "1": //人力资源 1已被占用,重新换一个 fieldType = "-1"; break; case "3": //会议室联系单 3已被占用,重新换一个 fieldType = "-3"; break; case "5": //仓库5已被占用,重新换一个 fieldType = "-5"; break; default: fieldType = type; break; } } else { continue; } if ("".equals(labelName)) { labelName = SystemEnv.getHtmlLabelName(fieldLabel, user.getLanguage()); } obj.put("key", fieldId); obj.put("fieldid", fieldId); obj.put("showname", labelName); obj.put("isdetailtable", "0"); obj.put("type", fieldType); obj.put("isShowModel", isShowModel); options.add(obj); } } apiDatas.put("options", options); apiDatas.put("groupidOptions", new JSONArray()); return apiDatas; } @Override public Map saveQuickSearchInfo(Map params) { Map apiDatas = new HashMap<>(16); String isQuickSearch = Util.null2String(params.get("isquicksearch")); String isShowType = Util.null2String(params.get("isshowtype")); isShowType = StringUtils.isBlank(isShowType) ? "0" : isShowType; String isHideName = Util.null2String(params.get("ishidename")); isHideName = StringUtils.isBlank(isHideName) ? "0" : isHideName; String id = Util.null2String(params.get("id")); String data = Util.null2String(params.get("data")); JSONArray datas = JSONArray.parseArray(data); //配置信息更新 if ("0".equals(id) || "".equals(id)) { QuickSearchSetting quickSearchSetting = QuickSearchSetting.builder() .belongTo(user.getUID()) .isQuickSearch(Integer.parseInt(isQuickSearch)) .isShowType(Integer.parseInt(isShowType)) .isHideName(Integer.parseInt(isHideName)) .updateTor(user.getUID()) .updateDate(DateUtils.getCurrentDate()) .updateTime(DateUtils.getCurrentTime()) .build(); //第一次修改配置 getQuickSearchMapper().insertQuickSearchSetting(quickSearchSetting); } else { QuickSearchSetting quickSearchSetting = QuickSearchSetting.builder() .id(Integer.parseInt(id)) .isQuickSearch(Integer.parseInt(isQuickSearch)) .isShowType(Integer.parseInt(isShowType)) .isHideName(Integer.parseInt(isHideName)) .build(); getQuickSearchMapper().updateQuickSearchSetting(quickSearchSetting); } List quickSearchConditionList = getQuickSearchMapper().getQuickSearchConditionList(user.getUID()); List list = quickSearchConditionList.stream().map(QuickSearchCondition::getId).collect(Collectors.toList()); for (int i = 0; i < datas.size(); i++) { JSONObject obj = (JSONObject) datas.get(i); String fieldId = obj.getString("fieldid"); String oriFieldId = obj.getString("orifieldid"); Integer cid = Util.getIntValue(obj.getString("cid")); String customName = obj.getString("customname"); String type = obj.getString("type"); String orderId = obj.getString("orderid"); String showModel = obj.getString("showmodel"); if (cid > 0) { list.remove(cid); QuickSearchCondition quickSearchCondition = QuickSearchCondition.builder() .belongTo(user.getUID()) .fieldId(fieldId) .customName(customName) .type(StringUtils.isBlank(type) ? null : Integer.parseInt(type)) .orderId(StringUtils.isBlank(orderId) ? null : Integer.parseInt(orderId)) .showModel(StringUtils.isBlank(showModel) ? null : Integer.parseInt(showModel)) .id(cid) .build(); getQuickSearchMapper().updateQuickSearchCondition(quickSearchCondition); if (!fieldId.equals(oriFieldId)) { //改变了字段,将原先字段的明细删除 getQuickSearchMapper().deleteQuickSearchDetailByCid(cid); } } else { QuickSearchCondition quickSearchCondition = QuickSearchCondition.builder() .belongTo(user.getUID()) .fieldId(fieldId) .customName(customName) .type(StringUtils.isBlank(type) ? null : Integer.parseInt(type)) .orderId(StringUtils.isBlank(orderId) ? null : Integer.parseInt(orderId)) .showModel(StringUtils.isBlank(showModel) ? null : Integer.parseInt(showModel)) .build(); getQuickSearchMapper().insertQuickSearchCondition(quickSearchCondition); } } if (CollectionUtils.isNotEmpty(list)) { getQuickSearchMapper().deleteQuickSearchConditionByIds(list); getQuickSearchMapper().deleteQuickSearchDetailByCids(list); } return apiDatas; } @Override public Map getQuickSearchDetailInfo(Map params) { Map apiDatas = new HashMap<>(16); String cid = weaver.formmode.exttools.impexp.common.StringUtils.null2String(params.get("cid")); //开关查询 List quickSearchDetailList = getQuickSearchMapper().getQuickSearchDetailByCid(cid); JSONArray datas = new JSONArray(); for (QuickSearchDetail quickSearchDetail : quickSearchDetailList) { JSONObject obj = new JSONObject(); String id = Util.null2String(quickSearchDetail.getId()); String customName = Util.null2String(quickSearchDetail.getCustomName()); String minNum = Util.null2String(quickSearchDetail.getMinNum()); minNum = minNum.startsWith("0E") ? "0" : minNum; String maxNum = Util.null2String(quickSearchDetail.getMaxNum()); maxNum = maxNum.startsWith("0E") ? "0" : maxNum; String type = Util.null2String(quickSearchDetail.getType()); String orderId = Util.null2String(quickSearchDetail.getOrderId()); String fieldId = Util.null2String(quickSearchDetail.getFieldId()); String belongTo = Util.null2String(quickSearchDetail.getBelongTo()); obj.put("id", id); obj.put("cid", cid); obj.put("key", id); obj.put("customname", customName); obj.put("minnum", minNum); obj.put("maxnum", maxNum); obj.put("type", type); obj.put("fieldid", fieldId); obj.put("belongto", belongTo); obj.put("orderid", orderId); datas.add(obj); } List quickSearchFieldList = getQuickSearchMapper().getQuickSearchFieldListByConditionId(cid); int precision = 0; for (QuickSearchField quickSearchField : quickSearchFieldList) { String fieldHtmlType = quickSearchField.getFieldHtmlType(); String type = quickSearchField.getType(); String fieldDbType = quickSearchField.getFieldDbType(); if ("1".equals(fieldHtmlType) && !"1".equals(type)) { int digitsIndex = fieldDbType.indexOf(","); precision = Util.getIntValue(fieldDbType.substring(digitsIndex + 1, fieldDbType.length() - 1), 0); } } apiDatas.put("datas", datas); apiDatas.put("precision", precision); return apiDatas; } @Override public Map saveQuickSearchDetailInfo(Map params) { Map apiDatas = new HashMap<>(16); String cid = Util.null2String(params.get("cid")); String data = Util.null2String(params.get("data")); JSONArray datas = JSONArray.parseArray(data); List list = getQuickSearchMapper().getQuickSearchDetailByCid(cid).stream().map(QuickSearchDetail::getId).collect(Collectors.toList()); try { for (int i = 0; i < datas.size(); i++) { JSONObject obj = (JSONObject) datas.get(i); String customName = obj.getString("customname"); String fieldId = obj.getString("fieldid"); String minNum = obj.getString("minnum"); minNum = "".equals(minNum) ? null : minNum; String maxNum = obj.getString("maxnum"); maxNum = "".equals(maxNum) ? null : maxNum; String type = obj.getString("type"); String orderId = obj.getString("orderid"); Integer id = Util.getIntValue(obj.getString("id")); QuickSearchDetail quickSearchDetail = QuickSearchDetail.builder() .cId(StringUtils.isBlank(cid) ? null : Integer.parseInt(cid)) .customName(customName) .minNum(StringUtils.isBlank(minNum) ? null : Integer.parseInt(minNum)) .maxNum(StringUtils.isBlank(maxNum) ? null : Integer.parseInt(maxNum)) .type(StringUtils.isBlank(type) ? null : Integer.parseInt(type)) .orderId(StringUtils.isBlank(orderId) ? null : Integer.parseInt(orderId)) .fieldId(fieldId) .belongTo(user.getUID()) .build(); if (id > 0) { list.remove(id); quickSearchDetail.setId(id); getQuickSearchMapper().updateQuickSearchDetail(quickSearchDetail); } else { getQuickSearchMapper().insertQuickSearchDetail(quickSearchDetail); } } if (CollectionUtils.isNotEmpty(list)) { getQuickSearchMapper().deleteQuickSearchDetailByIds(list); } } catch (Exception e) { new BaseBean().writeLog(e); e.printStackTrace(); } 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> groupMap=new HashMap>(); // // // 表单字段 // 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 map = new HashMap(); // 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 options = new ArrayList(); // 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 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 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 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 options = new ArrayList(); // 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 options = new ArrayList(); // 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 options = new ArrayList(); // 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 dataValue = new ArrayList(); // 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 valueObj = null; // List> replaceDatas = new ArrayList>(); // try { // valueObj = browserValueInfoService.getBrowserValueInfo(Util.getIntValue(fieldtype), fielddbtype, 0, searchparavalue, user.getLanguage(), -1); // for(int i=0;i map = new HashMap(); // 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 valueObj = null; // List> replaceDatas = new ArrayList>(); // try { // valueObj = browserValueInfoService.getBrowserValueInfo(Util.getIntValue(fieldtype), fielddbtype, 0, searchparavalue, user.getLanguage(), -1); // for(int i=0;i map = new HashMap(); // 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 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 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 valueObj = null; // List> replaceDatas = new ArrayList>(); // try { // valueObj = browserValueInfoService.getBrowserValueInfo(fieldtype, String.valueOf(fielddbtype), 0, searchparavalue, user.getLanguage(), "",""); // for(int i=0;i map = new HashMap(); // 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 map = new HashMap(); // Map map1 = new HashMap(); // Map map2 = new HashMap(); // 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 valueObj = null; // List> replaceDatas = new ArrayList>(); // try { // valueObj = browserValueInfoService.getBrowserValueInfo(fieldtype, String.valueOf(fielddbtype), 0, searchparavalue, user.getLanguage(), "",""); // for(int i=0;i map = new HashMap(); // 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 map = new HashMap(); // Map map1 = new HashMap(); // Map map2 = new HashMap(); // 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 valueObj = null; // List> replaceDatas = new ArrayList>(); // try { // valueObj = browserValueInfoService.getBrowserValueInfo(Util.getIntValue(fieldtype), fielddbtype, 0, searchparavalue, user.getLanguage(), -1); // for(int i=0;i map = new HashMap(); // if("141".equals(fieldtype)){ // map = (Map)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 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 list=groupMap.get(groupid); // if(null==list){ // list=new ArrayList(); // } // list.add(json); // groupMap.put(groupid,list); // }else{ // datas.add(json); // } // } // // rs.executeQuery("select * from mode_customsearchgroup where customid=?",customid); // Map group=new HashMap(); // 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 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