package com.api.aiyh_pcn.patentWall.service; import aiyh.utils.Util; import aiyh.utils.zwl.common.ToolUtil; import com.alibaba.fastjson.JSON; import com.api.aiyh_pcn.patentWall.dao.PatentWallMapping; import com.api.aiyh_pcn.patentWall.dto.FilterWhere; import com.api.aiyh_pcn.patentWall.vo.PatentVO; import com.api.aiyh_pcn.patentWall.vo.SearchInputVO; import com.api.aiyh_pcn.patentWall.vo.SelectOptionsVo; import weaver.conn.RecordSet; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @author EBU7-dev1-ayh * @create 2021/11/25 0025 15:23 */ public class PatentWallService { private final PatentWallMapping patentWallMapping = new PatentWallMapping(); private final ToolUtil toolUtil = new ToolUtil(); private Map patentWallConf; private Map patentWallSearchConf; private final RecordSet rs = new RecordSet(); /** * 查询搜索框配置信息 * * @param prefix 前缀 * @return 配置信息 */ public List getSearchList(String prefix,int languageId) { Map patentWallSearchConf = getPatentWallSearchConf(prefix + ".search"); String dataResource = String.valueOf(patentWallSearchConf.get("dataResource")); List> inputs = (List>) patentWallSearchConf.get("inputs"); List searchInputList = new ArrayList<>(); for (Map input : inputs) { SearchInputVO searchInputVO = new SearchInputVO(); int type = Integer.parseInt(Util.null2DefaultStr(input.get("type"), "0")); String dbFieldName = Util.null2String(input.get("dbFieldName")); String value = Util.null2String(input.get("value")); String labelName = Util.null2String(input.get("labelName")); Integer labelIndex = Integer.valueOf(Util.null2DefaultStr(input.get("labelIndex"),"0")); Integer searchType = Integer.valueOf(Util.null2DefaultStr(input.get("searchType"),"0")); Boolean multiple = Boolean.valueOf(Util.null2DefaultStr(input.get("multiple"),"false")); searchInputVO.setType(type); searchInputVO.setLabelName(labelName); searchInputVO.setSearchType(searchType); searchInputVO.setDbFieldName(dbFieldName); searchInputVO.setLabelIndex(labelIndex); searchInputVO.setLabelIndex(labelIndex); searchInputVO.setMultiple(multiple); searchInputVO.setValue(value); searchInputList.add(searchInputVO); switch (type) { case 1: // 下拉框 查询options List optionsVos = getSelectOptions(dataResource, dbFieldName,languageId); searchInputVO.setSelectOptions(optionsVos); case 2: // 单行文本 break; case 3: // 日期 case 4: // 单人力资源 break; case 5: // 多人力资源 break; case 6: // 流程路径 break; case 7: // 多流程路径 break; default: toolUtil.writeDebuggerLog("未匹配输入框类型!请检查配置文件是否正确!"); break; } } return searchInputList; } private List getSelectOptions(String dataResource, String dbFieldName, int languageId) { List> selectOptions = patentWallMapping.getSelectOptions(dataResource, dbFieldName); List optionsVos = new ArrayList<>(); SelectOptionsVo optionsDefault = new SelectOptionsVo(); optionsDefault.setSelected(true); optionsDefault.setKey(""); optionsDefault.setShowname(""); optionsVos.add(optionsDefault); for (Map selectOption : selectOptions) { SelectOptionsVo optionsVo = new SelectOptionsVo(); optionsVo.setSelected(false); optionsVo.setKey(Util.null2DefaultStr(selectOption.get("selectvalue"),"")); String selectName = Util.null2DefaultStr(selectOption.get("selectname"), ""); String showName = selectName; if (selectName.startsWith("~`~`") && selectName.endsWith("`~`~")) { String pattern = "(`~`" + languageId + " )(?