|
@@ -9,6 +9,7 @@ import com.lantone.qc.nlp.participle.cfg.DefaultConfig;
|
|
|
import com.lantone.qc.pub.util.FastJsonUtils;
|
|
|
import com.lantone.qc.pub.util.FileUtil;
|
|
|
import com.lantone.qc.trans.comsis.ModuleMappingUtil;
|
|
|
+import org.apache.commons.io.FileUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -19,7 +20,9 @@ import org.springframework.boot.ApplicationRunner;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.util.ResourceUtils;
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.io.FileNotFoundException;
|
|
|
+import java.io.InputStream;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Comparator;
|
|
@@ -63,12 +66,10 @@ public class CacheUtil implements ApplicationRunner {
|
|
|
private void loadModuleMappingInfo() {
|
|
|
List<String> xmlDataTypeHospitalIds = Lists.newArrayList("1", "3");
|
|
|
try {
|
|
|
- String mappingMsg = "";
|
|
|
- Configuration configuration = new DefaultConfig();
|
|
|
- List<String> lines = configuration.readTargetFileContents("cache/" + hospitalId + "/module_mapping.json");
|
|
|
- for (String line : lines) {
|
|
|
- mappingMsg +=line;
|
|
|
- }
|
|
|
+ InputStream stream = getClass().getClassLoader().getResourceAsStream("cache/" + hospitalId + "/module_mapping.json");
|
|
|
+ File targetFile = new File("module_mapping.json");
|
|
|
+ FileUtils.copyInputStreamToFile(stream, targetFile);
|
|
|
+ String mappingMsg = FileUtils.readFileToString(targetFile);
|
|
|
logger.error("模板数据:"+mappingMsg);
|
|
|
|
|
|
// String path = ResourceUtils.getURL("classpath:").getPath() + "cache/" + hospitalId + "/module_mapping.json";
|