|
@@ -1,77 +0,0 @@
|
|
|
-package com.lantone.qc.kernel.util;
|
|
|
-
|
|
|
-import com.google.common.collect.Lists;
|
|
|
-import com.google.common.collect.Maps;
|
|
|
-import com.google.common.collect.Sets;
|
|
|
-import com.lantone.qc.pub.util.StringUtil;
|
|
|
-import lombok.Getter;
|
|
|
-import lombok.Setter;
|
|
|
-import org.apache.commons.collections.MapUtils;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-
|
|
|
-import java.util.*;
|
|
|
-
|
|
|
-/**
|
|
|
- * @Description: 页面模板映射工具类
|
|
|
- * @author: rengb
|
|
|
- * @time: 2020/4/30 10:03
|
|
|
- */
|
|
|
-@Component
|
|
|
-@Getter
|
|
|
-@Setter
|
|
|
-public class ModuleMappingUtil {
|
|
|
- @Value("${qc.hospital_id}")
|
|
|
- private String hospitalId;
|
|
|
- private List<String> xmlDataTypeHospitalIds = Lists.newArrayList("1", "3");
|
|
|
- private Map<Set<String>, String> xmlDataTypeModuleInfo = Maps.newLinkedHashMap();
|
|
|
-
|
|
|
- public void moduleIdInsert(Map<String, Object> pageData) {
|
|
|
- if (xmlDataTypeHospitalIds.contains(hospitalId)) {
|
|
|
- xmlDataTypeModuleIdInsert(pageData);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void xmlDataTypeModuleIdInsert(Map<String, Object> pageData) {
|
|
|
- if (MapUtils.isEmpty(pageData)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- List<Map<String, String>> sourceMaps = Lists.newArrayList();
|
|
|
- pageData.keySet().forEach(pageDataKey -> {
|
|
|
- Object object = pageData.get(pageDataKey);
|
|
|
- if (object instanceof List) {
|
|
|
- sourceMaps.addAll((List) object);
|
|
|
- } else if (object instanceof Map) {
|
|
|
- sourceMaps.add((Map) object);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- sourceMaps.forEach(sourceMap -> {
|
|
|
- if (MapUtils.isNotEmpty(sourceMap)) {
|
|
|
- Set<String> set = sourceMap.keySet();
|
|
|
- List list = new ArrayList(set);
|
|
|
- list.sort(new Comparator<String>() {
|
|
|
- @Override
|
|
|
- public int compare(String arg0, String arg1) {
|
|
|
- return arg0.compareTo(arg1);//这是顺序
|
|
|
- }
|
|
|
- });
|
|
|
- set = Sets.newLinkedHashSet(list);
|
|
|
-// if (set.size() == 335) {
|
|
|
-// System.out.println(" ");
|
|
|
-// for (Map.Entry<Set<String>, String> entry : xmlDataTypeModuleInfo.entrySet()) {
|
|
|
-// System.out.println(StringUtils.join(entry.getKey(), ","));
|
|
|
-// }
|
|
|
-// System.out.println(StringUtils.join(set, ","));
|
|
|
-// }
|
|
|
- String modeId = xmlDataTypeModuleInfo.get(set);
|
|
|
- if (StringUtil.isNotBlank(modeId)) {
|
|
|
- System.out.println("modeId : " + modeId);
|
|
|
- sourceMap.put("mode_id", modeId);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
-}
|