|
@@ -0,0 +1,777 @@
|
|
|
+package com.tencent.service;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.tencent.dao.HwDao;
|
|
|
+import com.tencent.pojo.LnPmDataFh;
|
|
|
+import com.tencent.pojo.LnPmDataHw;
|
|
|
+import com.tencent.pojo.LnPmDataZx;
|
|
|
+import lombok.extern.log4j.Log4j2;
|
|
|
+import org.apache.commons.csv.CSVFormat;
|
|
|
+import org.apache.commons.csv.CSVParser;
|
|
|
+import org.apache.commons.csv.CSVPrinter;
|
|
|
+import org.apache.commons.csv.CSVRecord;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import java.io.*;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.Iterator;
|
|
|
+import java.util.List;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
+@Service
|
|
|
+@Log4j2
|
|
|
+public class HwServiceImpl extends ServiceImpl<HwDao, LnPmDataHw> implements HwService {
|
|
|
+ @Value("${huawei.directory}")
|
|
|
+ private String huaweiDirectory;
|
|
|
+ @Value("${huawei.performance.files}")
|
|
|
+ private String HuaweiPerformanceFiles;
|
|
|
+ @Value("${huawei.performance.read}")
|
|
|
+ private String huaweiPerformanceRead;
|
|
|
+ @Value("${huawei.performance.write}")
|
|
|
+ private String huaweiPerformanceWrite;
|
|
|
+ @Value("${huaweince.performance.files}")
|
|
|
+ private String huaweincePerformanceFiles;
|
|
|
+ @Value("${huaweince.performance.read}")
|
|
|
+ private String huaweincePerformanceRead;
|
|
|
+ @Value("${zhongxing.directory}")
|
|
|
+ private String zhongxingDirectory;
|
|
|
+ @Value("${zhongxing.performance.files}")
|
|
|
+ private String zhongxingPerformanceFiles;
|
|
|
+ @Value("${zhongxing.performance.read}")
|
|
|
+ private String zhongxingPerformanceRead;
|
|
|
+ @Value("${zhongxing.performance.write}")
|
|
|
+ private String zhongxingPerformanceWrite;
|
|
|
+ @Value("${fenghuo.directory}")
|
|
|
+ private String fenghuoDirectory;
|
|
|
+ @Value("${fenghuo.performance.files}")
|
|
|
+ private String fenghuoPerformanceFiles;
|
|
|
+ @Value("${fenghuo.performance.read}")
|
|
|
+ private String fenghuoPerformanceRead;
|
|
|
+ @Value("${fenghuo.performance.write}")
|
|
|
+ private String fenghuoPerformanceWrite;
|
|
|
+
|
|
|
+ //hw文件所需静态常量
|
|
|
+ private static final String ZONG_SHUCHU_ZUIJINZHI="总输出光功率最近值";
|
|
|
+ private static final String ZONG_SHURU_ZUIJINZHI="总输入光功率最近值";
|
|
|
+ private static final String ZONG_SHUCHU_ZUIDAZHI="总输出光功率最大值";
|
|
|
+ private static final String ZONG_SHUCHU_ZUIXIAOZHI="总输出光功率最小值";
|
|
|
+ private static final String ZONG_SHURU_ZUIDAZHI="总输入光功率最大值";
|
|
|
+ private static final String ZONG_SHURU_ZUIXIAOZHI="总输入光功率最小值";
|
|
|
+ //hwNCE文件所需静态常量
|
|
|
+ private static final String SHUCHU_DANGQIANZHI="输出光功率当前值";
|
|
|
+ private static final String SHURU_DANGQIANZHI="输入光功率当前值";
|
|
|
+ private static final String SHUCHU_ZUIDAZHI="输出光功率最大值";
|
|
|
+ private static final String SHUCHU_ZUIXIAOZHI="输出光功率最小值";
|
|
|
+ private static final String SHURU_ZUIDAZHI="输入光功率最大值";
|
|
|
+ private static final String SHURU_ZUIXIAOZHI="输入光功率最小值";
|
|
|
+ //烽火文件所需静态常量
|
|
|
+ private static final String SHUCHU_GUANGGONGLV="输出光功率";
|
|
|
+ private static final String SHURU_GUANGGONGLV="输入光功率";
|
|
|
+ private static final String SHUCHU_GUANGGONGLVFENGZHI="输出光功率峰值";
|
|
|
+ private static final String SHUCHU_GUANGGONGLVGUZHI="输出光功率谷值";
|
|
|
+ private static final String SHURU_FENGZHI="输入光功率峰值";
|
|
|
+ private static final String SHURU_GUZHI="输入光功率谷值";
|
|
|
+ private static final String VOA_SUAIJIANZHI="VOA衰减值";
|
|
|
+ private static final String CHUANSHU_SHUCHU_GUANGUANGGONGLV="传输层激光器输出光功率";
|
|
|
+ private static final String CHUANSHU_SHURUGUANGGONGLV="传输层输入光功率";
|
|
|
+ private static final String KEBIAN_SUAIJIANLIANG="可变衰减器的衰减量";
|
|
|
+ private static final String DANGQIANZHI="当前值";
|
|
|
+ private final HwDao hwDao;
|
|
|
+ @Autowired
|
|
|
+ public HwServiceImpl(HwDao hwDao) {
|
|
|
+ this.hwDao = hwDao;
|
|
|
+ }
|
|
|
+ //@Scheduled(cron = "0/15 * * * * ?")
|
|
|
+ @Scheduled(cron = "0 0 13 * * ?")
|
|
|
+ public void scan() throws IOException {
|
|
|
+ File file = new File(huaweiDirectory);
|
|
|
+ String[] list = file.list();
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
|
|
+ String format = dateFormat.format(new Date());
|
|
|
+ for (String s : list) {
|
|
|
+ //----------------------华为性能--------------
|
|
|
+ if (s.equals(HuaweiPerformanceFiles+format+".txt")){
|
|
|
+ String fileReadHwPath=huaweiPerformanceRead+format+".txt";
|
|
|
+ String fileWriteHwPath=huaweiPerformanceWrite;
|
|
|
+ readHwCsv(fileReadHwPath,fileWriteHwPath);
|
|
|
+ }
|
|
|
+ //NCE性能------------------------------
|
|
|
+ if (s.equals(huaweincePerformanceFiles+format+".txt")){
|
|
|
+ String fileReadHwPath=huaweincePerformanceRead+format+".txt";
|
|
|
+ String fileWriteHwPath=huaweiPerformanceWrite;
|
|
|
+ readHwNCECsv(fileReadHwPath,fileWriteHwPath);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ File file1 = new File(zhongxingDirectory);
|
|
|
+ String[] list1 = file1.list();
|
|
|
+ for (String s : list1) {
|
|
|
+ //------------------中兴性能数据-------------------
|
|
|
+ if (s.equals(zhongxingPerformanceFiles+format+".csv")){
|
|
|
+ String fileReadZxCsv=zhongxingPerformanceRead+format+".csv";
|
|
|
+ String fileWriteZxPath=zhongxingPerformanceWrite;
|
|
|
+ readZxCsv(fileReadZxCsv,fileWriteZxPath);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ File file2 = new File(fenghuoDirectory);
|
|
|
+ String[] name = file2.list();
|
|
|
+ for (String s : name) {
|
|
|
+ //--------------------烽火性能数据——---------------------------
|
|
|
+ if (s.equals(fenghuoPerformanceFiles+format+".txt")){
|
|
|
+ String fileReadFhPath=fenghuoPerformanceRead+format+".txt";
|
|
|
+ String fileWithFhPath=fenghuoPerformanceWrite;
|
|
|
+ readFhCsv(fileReadFhPath,fileWithFhPath);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * in_pm_data_hw 数据读取
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public static void readHwCsv(String fileReadHwPath,String fileWriteHwPath) throws IOException {
|
|
|
+ CSVFormat build = CSVFormat.DEFAULT.withFirstRecordAsHeader().builder().setHeader("ONEID", "ONEName", "NEID", "NEName", "NEType", "ShelfID",
|
|
|
+ "BrdID", "BrdType", "BrdName", "PortID", "PortNO", "PortName", "MOType", "FBName", "PathID",
|
|
|
+ "EventID", "EventName", "Period", "EndTime", "Value", "UnitName", "PMParameterName", "PMLocationID",
|
|
|
+ "PMLocation", "UpLevel", "DownLevel", "ResultOfLevel").setDelimiter("\t").build();
|
|
|
+ FileReader fileReader = new FileReader(fileReadHwPath);
|
|
|
+ CSVParser csvRecords = build.parse(fileReader);
|
|
|
+ Iterator<CSVRecord> iterator = csvRecords.iterator();
|
|
|
+ ArrayList<LnPmDataHw> objects = new ArrayList<>();
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ CSVRecord next = iterator.next();
|
|
|
+ if (next.get("PortName").contains("PA") || next.get("PortName").contains("BA")) {
|
|
|
+ } else {
|
|
|
+ if (next.get("BrdName").contains("OA") || next.get("BrdName").contains("OB") || next.get("BrdName").contains("PA")
|
|
|
+ || next.get("BrdName").contains("ONA") || next.get("BrdName").
|
|
|
+ contains("OLA") || next.get("BrdName").contains("DAPXF")) {
|
|
|
+ LnPmDataHw lnPmDataHw = new LnPmDataHw();
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String format = dateFormat.format(new Date());
|
|
|
+ lnPmDataHw.setSdate(format);
|
|
|
+ String oneName = next.get("NEName");
|
|
|
+ //objects.add(0,oneName);
|
|
|
+ lnPmDataHw.setSubName(oneName);
|
|
|
+ lnPmDataHw.setShelfId(next.get("ShelfID"));
|
|
|
+ lnPmDataHw.setSlotId(next.get("BrdID"));
|
|
|
+ String[] split = oneName.split("\t");
|
|
|
+ String[] split1 = split[split.length - 1].split("-");
|
|
|
+ String split2 = split1[0];
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
+ if (split[i].contains("工程态")) {
|
|
|
+ Pattern compile = Pattern.compile("([\\u4e00-\\u9fa5]+)");
|
|
|
+ Matcher matcher = compile.matcher(split[i]);
|
|
|
+ String s = matcher.replaceAll("").trim();
|
|
|
+ lnPmDataHw.setEquipmentId(s);
|
|
|
+ if (s.charAt(s.length() - 1) == '-') {
|
|
|
+ String[] split3 = s.split("-");
|
|
|
+ lnPmDataHw.setEquipmentId(split3[0]);
|
|
|
+ }
|
|
|
+ } else if (split[i].contains("邯郸") && Integer.parseInt(split2) < 1000) {
|
|
|
+ String substring = split[i].substring(0, 8).trim();
|
|
|
+ lnPmDataHw.setEquipmentId(substring);
|
|
|
+ } else {
|
|
|
+ lnPmDataHw.setEquipmentId(split2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (next.get(16).contains(ZONG_SHUCHU_ZUIJINZHI) || next.get(16).contains(SHUCHU_DANGQIANZHI)){
|
|
|
+ lnPmDataHw.setOutPower(Double.parseDouble(next.get(19)));
|
|
|
+ } else if (next.get(16).contains(ZONG_SHURU_ZUIJINZHI) || next.get(16).contains(SHURU_DANGQIANZHI)) {
|
|
|
+ lnPmDataHw.setInPower(Double.parseDouble(next.get(19)));
|
|
|
+ } else if (next.get(16).contains(ZONG_SHUCHU_ZUIDAZHI) || next.get(16).contains(SHUCHU_ZUIDAZHI)) {
|
|
|
+ lnPmDataHw.setOutPowerMax(Double.parseDouble(next.get(19)));
|
|
|
+ } else if (next.get(16).contains(ZONG_SHUCHU_ZUIXIAOZHI) || next.get(16).contains(SHUCHU_ZUIXIAOZHI)) {
|
|
|
+ lnPmDataHw.setOutPowerMin(Double.parseDouble(next.get(19)));
|
|
|
+ } else if (next.get(16).contains(ZONG_SHURU_ZUIDAZHI) || next.get(16).contains(SHURU_ZUIDAZHI)) {
|
|
|
+ lnPmDataHw.setInPowerMax(Double.parseDouble(next.get(19)));
|
|
|
+ } else if (next.get(16).contains(ZONG_SHURU_ZUIXIAOZHI) || next.get(16).contains(SHURU_ZUIXIAOZHI)){
|
|
|
+ lnPmDataHw.setInPowerMin(Double.parseDouble(next.get(19)));
|
|
|
+ }
|
|
|
+ objects.add(lnPmDataHw);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ writeHwCsv(objects, fileWriteHwPath,fileReadHwPath);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * in_pm_data_hw 数据导出
|
|
|
+ *
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public static void writeHwCsv(List<LnPmDataHw> data, String fileWriteHwPath, String fileReadHwPath) throws IOException {
|
|
|
+ String NEW_LINE_SEPARATOR = "\n";
|
|
|
+ OutputStreamWriter gbk = new OutputStreamWriter((new FileOutputStream(new File(fileWriteHwPath))), "UTF-8");
|
|
|
+ CSVFormat formator = CSVFormat.DEFAULT.withRecordSeparator(NEW_LINE_SEPARATOR).builder().setDelimiter("|").build();
|
|
|
+ CSVPrinter csvPrinter = new CSVPrinter(gbk, formator);
|
|
|
+ for (LnPmDataHw dataHw : data) {
|
|
|
+ if (dataHw != null) {
|
|
|
+ csvPrinter.printRecord(dataHw.getSdate(),
|
|
|
+ dataHw.getSubName(), dataHw.getEquipmentId(),
|
|
|
+ dataHw.getShelfId(), dataHw.getSlotId(),
|
|
|
+ dataHw.getOutPower(), dataHw.getInPower(),
|
|
|
+ dataHw.getOutPowerMax(), dataHw.getOutPowerMin(),
|
|
|
+ dataHw.getInPowerMax(), dataHw.getInPowerMin());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ csvPrinter.close();
|
|
|
+ excuteHwCommand(fileWriteHwPath,fileReadHwPath);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * in_pm_data_hw 调用shell脚本入库
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public static void excuteHwCommand(String fileWriteHwPath,String fileReadHwPath) {
|
|
|
+ // String command="psql -U postgres -d sqmmt -c \"\\copy dim_pm.in_pm_data_hw from '"+fileWriteHwPath+"' with DELIMITER '|' null ''\";";
|
|
|
+ String command = "sh /data/gtj/pm/sh/pmHw.sh " + fileWriteHwPath;
|
|
|
+ Runtime r = Runtime.getRuntime();
|
|
|
+ Process p;
|
|
|
+ try {
|
|
|
+ p = r.exec(command);
|
|
|
+ BufferedReader br = new BufferedReader(
|
|
|
+ new InputStreamReader(p.getInputStream()));
|
|
|
+ String inline;
|
|
|
+ while ((inline = br.readLine()) != null) {
|
|
|
+ log.info(inline);
|
|
|
+ }
|
|
|
+ log.info("------------性能pm华为----出错信息--------");
|
|
|
+ BufferedReader br_error = new BufferedReader(
|
|
|
+ new InputStreamReader(p.getErrorStream()));
|
|
|
+ while ((inline = br_error.readLine()) != null) {
|
|
|
+ log.info(inline);
|
|
|
+ }
|
|
|
+ File file = new File(fileReadHwPath);
|
|
|
+ File file2 = new File("/data/gtj/pm/file/hw/" + file.getName());
|
|
|
+ if (file.renameTo(file2)){
|
|
|
+ file.delete();
|
|
|
+ log.info("---HW性能--读文件删除成功----");
|
|
|
+ }
|
|
|
+ File file1 = new File(fileWriteHwPath);
|
|
|
+ if (file1.delete()){
|
|
|
+ log.info("---HW性能--写文件删除成功----");
|
|
|
+ }else {
|
|
|
+ log.info("---HW性能--写文件删除失败-----");
|
|
|
+ }
|
|
|
+ log.info(fileReadHwPath+"---性能pm华为--入库成功----------");
|
|
|
+ br.close();
|
|
|
+ br_error.close();
|
|
|
+ timePmHw();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * in_pm_data_hwNCE 数据读取
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public static void readHwNCECsv(String fileReadHwPath,String fileWriteHwPath) throws IOException {
|
|
|
+ CSVFormat build = CSVFormat.DEFAULT.withFirstRecordAsHeader().builder().setHeader("oneid", "onename", "neid", "nename", "netype", "shelfid",
|
|
|
+ "brdid", "brdtype", "brdname", "portid", "portno", "portname", "motype", "fbname", "pathid",
|
|
|
+ "eventid", "eventname", "period", "endtime", "value", "unitname", "pmparametername", "pmlocationid",
|
|
|
+ "pmlocation", "uplevel", "downlevel", "resultoflevel").setDelimiter("^").build();
|
|
|
+ FileReader fileReader = new FileReader(fileReadHwPath);
|
|
|
+ CSVParser csvRecords = build.parse(fileReader);
|
|
|
+ Iterator<CSVRecord> iterator = csvRecords.iterator();
|
|
|
+ ArrayList<LnPmDataHw> objects = new ArrayList<>();
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ CSVRecord next = iterator.next();
|
|
|
+ if (next.get("portname").contains("PA") || next.get("portname").contains("BA")) {
|
|
|
+ } else {
|
|
|
+ if (next.get("brdname").contains("OA") || next.get("brdname").contains("OB") || next.get("brdname").contains("PA")
|
|
|
+ || next.get("brdname").contains("ONA") || next.get("brdname").
|
|
|
+ contains("OLA") || next.get("brdname").contains("DAPXF")) {
|
|
|
+ LnPmDataHw lnPmDataHw = new LnPmDataHw();
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String format = dateFormat.format(new Date());
|
|
|
+ lnPmDataHw.setSdate(format);
|
|
|
+ String oneName = next.get("nename");
|
|
|
+ //objects.add(0,oneName);
|
|
|
+ lnPmDataHw.setSubName(oneName);
|
|
|
+ lnPmDataHw.setShelfId(next.get("shelfid"));
|
|
|
+ lnPmDataHw.setSlotId(next.get("brdid"));
|
|
|
+ String nename = next.get("nename");
|
|
|
+ if (null!=nename){
|
|
|
+ String[] split = nename.split("-");
|
|
|
+ if (split[0].contains("工程态")){
|
|
|
+ lnPmDataHw.setEquipmentId(split[0].substring(3).trim());
|
|
|
+ }else {
|
|
|
+ lnPmDataHw.setEquipmentId(split[0].trim());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (next.get("eventname").contains(SHUCHU_DANGQIANZHI)) {
|
|
|
+ lnPmDataHw.setOutPower(Double.parseDouble(next.get(19)));
|
|
|
+ } else if (next.get("eventname").contains(SHURU_DANGQIANZHI)) {
|
|
|
+ //objects.add(5,next.get(19));
|
|
|
+ lnPmDataHw.setInPower(Double.parseDouble(next.get(19)));
|
|
|
+ } else if (next.get("eventname").contains(SHUCHU_ZUIDAZHI)) {
|
|
|
+ // objects.add(6,next.get(19));
|
|
|
+ double v = Double.parseDouble(next.get(19));
|
|
|
+ lnPmDataHw.setOutPowerMax(Double.parseDouble(next.get(19)));
|
|
|
+ } else if (next.get("eventname").contains(SHUCHU_ZUIXIAOZHI)) {
|
|
|
+ // objects.add(7,next.get(19));
|
|
|
+ lnPmDataHw.setOutPowerMin(Double.parseDouble(next.get(19)));
|
|
|
+ } else if (next.get("eventname").contains(SHURU_ZUIDAZHI)) {
|
|
|
+ //objects.add(8,next.get(19));
|
|
|
+ lnPmDataHw.setInPowerMax(Double.parseDouble(next.get(19)));
|
|
|
+ } else if (next.get("eventname").contains(SHURU_ZUIXIAOZHI)) {
|
|
|
+ lnPmDataHw.setInPowerMin(Double.parseDouble(next.get(19)));
|
|
|
+ }
|
|
|
+ objects.add(lnPmDataHw);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ writeHwNCECsv(objects, fileWriteHwPath,fileReadHwPath);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * in_pm_data_hwNCE 数据导出
|
|
|
+ *
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public static void writeHwNCECsv(List<LnPmDataHw> data, String fileWriteHwPath, String fileReadHwPath) throws IOException {
|
|
|
+ String NEW_LINE_SEPARATOR = "\n";
|
|
|
+ OutputStreamWriter gbk = new OutputStreamWriter((new FileOutputStream(new File(fileWriteHwPath))), "UTF-8");
|
|
|
+ CSVFormat formator = CSVFormat.DEFAULT.withRecordSeparator(NEW_LINE_SEPARATOR).builder().setDelimiter("|").build();
|
|
|
+ CSVPrinter csvPrinter = new CSVPrinter(gbk, formator);
|
|
|
+ for (LnPmDataHw dataHw : data) {
|
|
|
+ if (dataHw != null) {
|
|
|
+ csvPrinter.printRecord(dataHw.getSdate(),
|
|
|
+ dataHw.getSubName(), dataHw.getEquipmentId(),
|
|
|
+ dataHw.getShelfId(), dataHw.getSlotId(),
|
|
|
+ dataHw.getOutPower(), dataHw.getInPower(),
|
|
|
+ dataHw.getOutPowerMax(), dataHw.getOutPowerMin(),
|
|
|
+ dataHw.getInPowerMax(), dataHw.getInPowerMin());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ csvPrinter.close();
|
|
|
+ excuteHwCommandNCE(fileWriteHwPath,fileReadHwPath);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * in_pm_data_hwNCE 调用shell脚本入库
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public static void excuteHwCommandNCE(String fileWriteHwPath,String fileReadHwPath) {
|
|
|
+ // String command="psql -U postgres -d sqmmt -c \"\\copy dim_pm.in_pm_data_hw from '"+fileWriteHwPath+"' with DELIMITER '|' null ''\";";
|
|
|
+ String command = "sh /data/gtj/pm/sh/pmHwNCE.sh " + fileWriteHwPath;
|
|
|
+ Runtime r = Runtime.getRuntime();
|
|
|
+ Process p;
|
|
|
+ try {
|
|
|
+ p = r.exec(command);
|
|
|
+ BufferedReader br = new BufferedReader(
|
|
|
+ new InputStreamReader(p.getInputStream()));
|
|
|
+ String inline;
|
|
|
+ while ((inline = br.readLine()) != null) {
|
|
|
+ log.info(inline);
|
|
|
+ }
|
|
|
+ log.info("------------性能pm华为----出错信息--------");
|
|
|
+ BufferedReader br_error = new BufferedReader(
|
|
|
+ new InputStreamReader(p.getErrorStream()));
|
|
|
+ while ((inline = br_error.readLine()) != null) {
|
|
|
+ log.info(inline);
|
|
|
+ }
|
|
|
+ File file = new File(fileReadHwPath);
|
|
|
+ File file2 = new File("/data/gtj/pm/file/hw/" + file.getName());
|
|
|
+ if (file.renameTo(file2)){
|
|
|
+ file.delete();
|
|
|
+ log.info("---HW性能--读文件删除成功----");
|
|
|
+ }
|
|
|
+ File file1 = new File(fileWriteHwPath);
|
|
|
+ if (file1.delete()){
|
|
|
+ log.info("---HW性能--写文件删除成功----");
|
|
|
+ }else {
|
|
|
+ log.info("---HW性能--写文件删除失败-----");
|
|
|
+ }
|
|
|
+ log.info(fileReadHwPath+"---性能pm华为--入库成功----------");
|
|
|
+ br.close();
|
|
|
+ br_error.close();
|
|
|
+ timePmHw();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * in_update_timestamp
|
|
|
+ * 各表时间戳数据汇总
|
|
|
+ * in_pm_data_hwNCE 时间字段入库
|
|
|
+ */
|
|
|
+ public static void timePmHw() {
|
|
|
+ // String command="psql -U postgres -d sqmmt -c \"\\copy dim_pm.in_pm_data_hw from '"+fileWriteHwPath+"' with DELIMITER '|' null ''\";";
|
|
|
+ String command = "sh /data/gtj/pm/sh/timestampPmHwNCE.sh";
|
|
|
+ Runtime r = Runtime.getRuntime();
|
|
|
+ Process p;
|
|
|
+ try {
|
|
|
+ p = r.exec(command);
|
|
|
+ BufferedReader br = new BufferedReader(
|
|
|
+ new InputStreamReader(p.getInputStream()));
|
|
|
+ String inline;
|
|
|
+ while ((inline = br.readLine()) != null) {
|
|
|
+ log.info(inline);
|
|
|
+ }
|
|
|
+ log.info("---------性能pm华为汇总时间-------出错信息--------");
|
|
|
+ BufferedReader br_error = new BufferedReader(
|
|
|
+ new InputStreamReader(p.getErrorStream()));
|
|
|
+ while ((inline = br_error.readLine()) != null) {
|
|
|
+ log.info(inline);
|
|
|
+ }
|
|
|
+ br.close();
|
|
|
+ br_error.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * in_pm_data_zx 数据导入
|
|
|
+ *
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public static void readZxCsv(String fileReadZxCsv, String fileWriteZxPath) throws IOException {
|
|
|
+ InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(new File(fileReadZxCsv)), "GBK");
|
|
|
+ CSVFormat build = CSVFormat.DEFAULT.withFirstRecordAsHeader().builder().setHeader("序号", "开始时间", "结束时间", "查询粒度", "网元位置", "测量对象位置", "" +
|
|
|
+ "输出光功率(dBm)", "最大输出光功率(dBm)", "最小输出光功率(dBm)", "平均输出光功率(dBm)", "输入光功率(dBm)"
|
|
|
+ , "最大输入光功率(dBm)", "最小输入光功率(dBm)", "平均输入光功率(dBm)", "中心波长(nm)", "中心波长最大值(nm)"
|
|
|
+ , "中心波长最小值(nm)", "中心波长平均值(nm)", "光信噪比(dB)", "光信噪比最大值(dB)", "" +
|
|
|
+ "光信噪比最小值(dB)", "光信噪比平均值(dB)", "中心波长偏移(nm)", "最大中心波长偏移(nm)", "最小中心波长偏移(nm)", "" +
|
|
|
+ "平均中心波长偏移(nm)", "FEC纠错前误码率", "FEC纠错后误码率", "SM严重误码秒比", "SM 远端严重误码秒比", "" +
|
|
|
+ "PM严重误码秒比", "PM 远端严重误码秒比", "单板环境温度(℃)", "单板环境温度值最大值(℃)", "单板环境温度值最小值(℃)", "" +
|
|
|
+ "单板环境温度值平均值(℃)", "模块温度(℃)", "最大模块温度(℃)", "最小模块温度(℃)", "平均模块温度(℃)", "泵浦激光器1偏置电流(mA)", "泵浦激光器2偏置电流(mA)", "大功率泵浦激光器偏置电流(mA)", "" +
|
|
|
+ "泵浦激光器2偏置电流最大值(mA)", "泵浦激光器2偏置电流最小值(mA)", "泵浦激光器2偏置电流平均值(mA)", "" +
|
|
|
+ "泵浦激光器1温度偏移平均值(℃)", "泵浦激光器1温度偏移最小值(℃)", "" +
|
|
|
+ "泵浦激光器1温度偏移最大值(℃)", "(mA)", "泵浦激光器1偏置电流最小值(mA)", "泵浦激光器1偏置电流平均值(mA)").setDelimiter(",").build();
|
|
|
+ CSVParser csvRecords = new CSVParser(inputStreamReader, build);
|
|
|
+ Iterator<CSVRecord> iterator = csvRecords.iterator();
|
|
|
+ ArrayList<LnPmDataZx> lnPmDataZxes = new ArrayList<>();
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ CSVRecord next = iterator.next();
|
|
|
+ if (!next.get("测量对象位置").contains("内部")){
|
|
|
+ if (next.get("测量对象位置").contains("EOBA") || next.get("测量对象位置").contains("EONA")
|
|
|
+ || next.get("测量对象位置").contains("EOPA") || next.get("测量对象位置").contains("SEOBA") || next.get("测量对象位置").contains("SEOPA")) {
|
|
|
+ //赋值NeLocation
|
|
|
+ LnPmDataZx lnPmDataZx = new LnPmDataZx();
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String format = dateFormat.format(new Date());
|
|
|
+ lnPmDataZx.setSdate(format);
|
|
|
+ lnPmDataZx.setNeLocation(next.get(4));
|
|
|
+ String s = next.get(4);
|
|
|
+ if (!s.contains("OA")) {
|
|
|
+ String s1 = next.get(4);
|
|
|
+ lnPmDataZx.setNeLocation(s1);
|
|
|
+ }
|
|
|
+ //通过下标 获取网元位置
|
|
|
+ String neLocation = next.get(4);
|
|
|
+ String[] split = neLocation.split(",");
|
|
|
+ // System.out.println(split.length);
|
|
|
+ String[] split1 = split[split.length - 1].split("-");
|
|
|
+ //赋值equipment_id
|
|
|
+ lnPmDataZx.setEquipmentId(split1[0]);
|
|
|
+ //赋值sub_name
|
|
|
+ lnPmDataZx.setSubName(split[split.length - 1]);
|
|
|
+ //赋值测量对象
|
|
|
+ String measurementObject = next.get(5);
|
|
|
+ lnPmDataZx.setMeasurementObject(measurementObject);
|
|
|
+ String[] split2 = measurementObject.split("-");
|
|
|
+ String slotId = null;
|
|
|
+ String shelfId = null;
|
|
|
+ if (split2.length > 3) {
|
|
|
+ shelfId = split2[1];
|
|
|
+ int index = split2[2].lastIndexOf("]");
|
|
|
+ slotId = split2[2].substring(0, index);
|
|
|
+ }
|
|
|
+ lnPmDataZx.setShelfId(shelfId);
|
|
|
+ lnPmDataZx.setSlotId(slotId);
|
|
|
+ try {
|
|
|
+ lnPmDataZx.setOutPower(Double.parseDouble(next.get(9)));
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ lnPmDataZx.setOutPower(null);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ lnPmDataZx.setInPower(Double.parseDouble(next.get(13)));
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ lnPmDataZx.setInPower(null);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ lnPmDataZx.setOutPowerMax(Double.parseDouble(next.get(7)));
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ lnPmDataZx.setOutPowerMax(null);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ lnPmDataZx.setOutPowerMin(Double.parseDouble(next.get(8)));
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ lnPmDataZx.setOutPowerMin(null);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ lnPmDataZx.setInPowerMax(Double.parseDouble(next.get(11)));
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ lnPmDataZx.setInPowerMax(null);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ lnPmDataZx.setInPowerMin(Double.parseDouble(next.get(12)));
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ lnPmDataZx.setInPowerMin(null);
|
|
|
+ }
|
|
|
+ lnPmDataZxes.add(lnPmDataZx);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ writeZxCsv(lnPmDataZxes, fileWriteZxPath,fileReadZxCsv);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * in_pm_data_zx 数据 导出
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public static void writeZxCsv(List<LnPmDataZx> data, String fileWriteZxPath, String fileReadZxCsv) throws IOException {
|
|
|
+ String NEW_LINE_SEPARATOR = "\n";
|
|
|
+ try {
|
|
|
+ OutputStreamWriter gbk = new OutputStreamWriter((new FileOutputStream(new File(fileWriteZxPath))), "UTF-8");
|
|
|
+ CSVFormat formator = CSVFormat.DEFAULT.withRecordSeparator(NEW_LINE_SEPARATOR).builder().setDelimiter("|").build();
|
|
|
+ CSVPrinter csvPrinter = new CSVPrinter(gbk, formator);
|
|
|
+ //csvPrinter.printRecord(header);
|
|
|
+ for (LnPmDataZx dataHw : data) {
|
|
|
+ if (dataHw != null) {
|
|
|
+ csvPrinter.printRecord(dataHw.getSdate(), dataHw.getNeLocation(),
|
|
|
+ dataHw.getEquipmentId(), dataHw.getSubName(), dataHw.getMeasurementObject(),
|
|
|
+ dataHw.getShelfId(), dataHw.getSlotId(),
|
|
|
+ dataHw.getOutPower(), dataHw.getInPower(),
|
|
|
+ dataHw.getOutPowerMax(), dataHw.getOutPowerMin(),
|
|
|
+ dataHw.getInPowerMax(), dataHw.getInPowerMin());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ csvPrinter.close();
|
|
|
+ excuteZxCommand2(fileWriteZxPath,fileReadZxCsv);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * in_pm_data_zx 调用shell脚本入库
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public static void excuteZxCommand2(String fileWriteZxPath,String fileReadZxCsv) {
|
|
|
+ String command = "sh /data/gtj/pm/sh/pmZx.sh " + fileWriteZxPath;
|
|
|
+ Runtime r = Runtime.getRuntime();
|
|
|
+ Process p;
|
|
|
+ try {
|
|
|
+ p = r.exec(command);
|
|
|
+ BufferedReader br = new BufferedReader(
|
|
|
+ new InputStreamReader(p.getInputStream()));
|
|
|
+ String inline;
|
|
|
+ while ((inline = br.readLine()) != null) {
|
|
|
+ log.info(inline);
|
|
|
+ }
|
|
|
+ log.info("--------性能pm中兴入库--------出错信息--------");
|
|
|
+ BufferedReader br_error = new BufferedReader(
|
|
|
+ new InputStreamReader(p.getErrorStream()));
|
|
|
+ while ((inline = br_error.readLine()) != null) {
|
|
|
+ log.info(inline);
|
|
|
+ }
|
|
|
+ File file = new File(fileReadZxCsv);
|
|
|
+ File file2 = new File("/data/gtj/pm/file/zx/" + file.getName());
|
|
|
+ if (file.renameTo(file2)){
|
|
|
+ file.delete();
|
|
|
+ log.info("---------ZX性能--读文件 删除成功");
|
|
|
+ }
|
|
|
+ File file1 = new File(fileWriteZxPath);
|
|
|
+ if (file1.delete()){
|
|
|
+ log.info("--------ZX性能---写文件 删除成功");
|
|
|
+ }else {
|
|
|
+ log.info("-------ZX性能---写文件 删除失败");
|
|
|
+ }
|
|
|
+ br.close();
|
|
|
+ br_error.close();
|
|
|
+ timePmZx();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * in_update_timestamp
|
|
|
+ * 各表时间戳数据汇总
|
|
|
+ * in_pm_data_zx 时间字段入库
|
|
|
+ */
|
|
|
+ public static void timePmZx() {
|
|
|
+ String command = "sh /data/gtj/pm/sh/timestampPmZx.sh";
|
|
|
+ Runtime r = Runtime.getRuntime();
|
|
|
+ Process p;
|
|
|
+ try {
|
|
|
+ p = r.exec(command);
|
|
|
+ BufferedReader br = new BufferedReader(
|
|
|
+ new InputStreamReader(p.getInputStream()));
|
|
|
+ String inline;
|
|
|
+ while ((inline = br.readLine()) != null) {
|
|
|
+ log.info(inline);
|
|
|
+ }
|
|
|
+ log.info("---------汇总时间中兴-------出错信息--------");
|
|
|
+ BufferedReader br_error = new BufferedReader(
|
|
|
+ new InputStreamReader(p.getErrorStream()));
|
|
|
+ while ((inline = br_error.readLine()) != null) {
|
|
|
+ log.info(inline);
|
|
|
+ }
|
|
|
+ br.close();
|
|
|
+ br_error.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * in_pm_data_fh 数据导入
|
|
|
+ */
|
|
|
+ public static void readFhCsv(String fileReadFhPath,String fileWithFhPath) throws IOException {
|
|
|
+ InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(new File(fileReadFhPath)), "UTF-8");
|
|
|
+ CSVFormat build = CSVFormat.RFC4180.withFirstRecordAsHeader().builder().setHeader("逻辑域", "性能源", "网元名称", "网元类型", "单盘名称",
|
|
|
+ "单盘类型", "槽位号", "线路号", "性能英文代码",
|
|
|
+ "性能名称", "开始时间", "结束时间", "单位",
|
|
|
+ "性能分组", "基准值", "预警门限", "告警门限", "当前值", "性能状态", "" +
|
|
|
+ "端口名称", "管理地址").setDelimiter(",").build();
|
|
|
+ CSVParser csvRecords = new CSVParser(inputStreamReader, build);
|
|
|
+ List<CSVRecord> records = csvRecords.getRecords();
|
|
|
+ ArrayList<LnPmDataFh> objects = new ArrayList<>();
|
|
|
+ for (int i = 0; i < records.size(); i++) {
|
|
|
+ if (i > 4) {
|
|
|
+ if (records.get(i).get("单盘名称").contains("OA") || records.get(i).get("单盘名称").contains("OB")
|
|
|
+ || records.get(i).get("单盘名称").contains("PA") || records.get(i).get("单盘名称").contains("ONA") ||
|
|
|
+ records.get(i).get("单盘名称").contains("OLA") || records.get(i).get("单盘名称").contains("DAPXF")) {
|
|
|
+ LnPmDataFh lnPmDataFh = new LnPmDataFh();
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String format = dateFormat.format(new Date());
|
|
|
+ lnPmDataFh.setSdate(format);
|
|
|
+ //获取网元名称
|
|
|
+ lnPmDataFh.setSubName(records.get(i).get(2).trim());
|
|
|
+ //获取单盘名称
|
|
|
+ lnPmDataFh.setSubrackName(records.get(i).get(4).trim());
|
|
|
+ //光放板子架默认0
|
|
|
+ lnPmDataFh.setShelfId("0");
|
|
|
+ //槽位号
|
|
|
+ lnPmDataFh.setHexSlotId(records.get(i).get(6).trim());
|
|
|
+ //槽位号 16进制转换10进制
|
|
|
+ String s = records.get(i).get(6);
|
|
|
+ long l = Long.parseLong(s, 16);
|
|
|
+ lnPmDataFh.setSlotId(l + "".trim());
|
|
|
+ //端口名称
|
|
|
+ lnPmDataFh.setPortName(records.get(i).get(19).trim());
|
|
|
+ if (records.get(i).get(9).equals(SHUCHU_GUANGGONGLV) ) {
|
|
|
+ lnPmDataFh.setOutPower(Double.parseDouble(records.get(i).get(DANGQIANZHI).trim()));
|
|
|
+ } else if (records.get(i).get(9).equals(SHURU_GUANGGONGLV) ) {
|
|
|
+ lnPmDataFh.setInPower(Double.parseDouble(records.get(i).get(DANGQIANZHI).trim()));
|
|
|
+ } else if (records.get(i).get(9).equals(SHUCHU_GUANGGONGLVFENGZHI)) {
|
|
|
+ lnPmDataFh.setOutPowerMax(Double.parseDouble(records.get(i).get(DANGQIANZHI).trim()));
|
|
|
+ } else if (records.get(i).get(9).equals(SHUCHU_GUANGGONGLVGUZHI)) {
|
|
|
+ lnPmDataFh.setOutPowerMin(Double.parseDouble(records.get(i).get(DANGQIANZHI).trim()));
|
|
|
+ } else if (records.get(i).get(9).equals(SHURU_FENGZHI)) {
|
|
|
+ lnPmDataFh.setInPowerMax(Double.parseDouble(records.get(i).get(DANGQIANZHI).trim()));
|
|
|
+ } else if (records.get(i).get(9).equals(SHURU_GUZHI)) {
|
|
|
+ lnPmDataFh.setInPowerMin(Double.parseDouble(records.get(i).get(DANGQIANZHI).trim()));
|
|
|
+ } else if (records.get(i).get(9).equals(VOA_SUAIJIANZHI)) {
|
|
|
+ lnPmDataFh.setVoaValue(Double.parseDouble(records.get(i).get(DANGQIANZHI).trim()));
|
|
|
+ }else if (records.get(i).get(9).equals(CHUANSHU_SHUCHU_GUANGUANGGONGLV)){
|
|
|
+ lnPmDataFh.setOutPower(Double.parseDouble(records.get(i).get(DANGQIANZHI).trim()));
|
|
|
+ }else if (records.get(i).get(9).equals(CHUANSHU_SHURUGUANGGONGLV)){
|
|
|
+ lnPmDataFh.setInPower(Double.parseDouble(records.get(i).get(DANGQIANZHI).trim()));
|
|
|
+ }else if (records.get(i).get(9).equals(KEBIAN_SUAIJIANLIANG)){
|
|
|
+ lnPmDataFh.setVoaValue(Double.parseDouble(records.get(i).get(DANGQIANZHI).trim()));
|
|
|
+ }
|
|
|
+ objects.add(lnPmDataFh);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ writeFhCsv(objects, fileWithFhPath,fileReadFhPath);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * in_pm_data_fh 数据导出
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public static void writeFhCsv(List<LnPmDataFh> data, String fileWithFhPath, String fileReadFhPath) throws IOException {
|
|
|
+ String NEW_LINE_SEPARATOR = "\n";
|
|
|
+ try {
|
|
|
+ OutputStreamWriter gbk = new OutputStreamWriter((new FileOutputStream(new File(fileWithFhPath))), "UTF-8");
|
|
|
+ CSVFormat formator = CSVFormat.DEFAULT.withRecordSeparator(NEW_LINE_SEPARATOR).builder().setDelimiter("|").build();
|
|
|
+ CSVPrinter csvPrinter = new CSVPrinter(gbk, formator);
|
|
|
+ for (LnPmDataFh dataHw : data) {
|
|
|
+ if (dataHw != null) {
|
|
|
+ csvPrinter.printRecord(dataHw.getSdate(), dataHw.getSubName(),
|
|
|
+ dataHw.getSubrackName(), dataHw.getShelfId(), dataHw.getHexSlotId(), dataHw.getSlotId(),
|
|
|
+ dataHw.getPortName(), dataHw.getOutPower(), dataHw.getInPower(),
|
|
|
+ dataHw.getOutPowerMax(), dataHw.getOutPowerMin(),
|
|
|
+ dataHw.getInPowerMax(), dataHw.getInPowerMin(), dataHw.getVoaValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ csvPrinter.close();
|
|
|
+ excuteFhCommand2(fileWithFhPath,fileReadFhPath);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * in_pm_data_fh 调用 shell脚本入库
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public static void excuteFhCommand2(String fileWithFhPath,String fileReadFhPath) {
|
|
|
+ String command = "sh /data/gtj/pm/sh/pmFh.sh " + fileWithFhPath;
|
|
|
+ Runtime r = Runtime.getRuntime();
|
|
|
+ Process p;
|
|
|
+ try {
|
|
|
+ p = r.exec(command);
|
|
|
+ BufferedReader br = new BufferedReader(
|
|
|
+ new InputStreamReader(p.getInputStream()));
|
|
|
+ String inline;
|
|
|
+ while ((inline = br.readLine()) != null) {
|
|
|
+ log.info(inline);
|
|
|
+ }
|
|
|
+ log.info("-------------pm烽火数据---入库--出错信息--------");
|
|
|
+ BufferedReader br_error = new BufferedReader(
|
|
|
+ new InputStreamReader(p.getErrorStream()));
|
|
|
+ while ((inline = br_error.readLine()) != null) {
|
|
|
+ log.info(inline);
|
|
|
+ }
|
|
|
+ File file = new File(fileReadFhPath);
|
|
|
+ File file2 = new File("/data/gtj/pm/file/fh/"+file.getName());
|
|
|
+ if (file.renameTo(file2)){
|
|
|
+ file.delete();
|
|
|
+ log.info("---------FH性能---读文件删除成功");
|
|
|
+ }else {
|
|
|
+ log.info("--------FH性能----读文件删除失败");
|
|
|
+ }
|
|
|
+ File file1 = new File(fileWithFhPath);
|
|
|
+ if (file1.delete()){
|
|
|
+ log.info("--------FH性能--写文件删除成功");
|
|
|
+ }
|
|
|
+ br.close();
|
|
|
+ br_error.close();
|
|
|
+ timePmFh();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * in_update_timestamp
|
|
|
+ * 各表时间戳数据汇总
|
|
|
+ * in_pm_data_fh 调用 shell脚本 时间字段入库
|
|
|
+ */
|
|
|
+ public static void timePmFh() {
|
|
|
+ String command = "sh /data/gtj/pm/sh/timestampPmFh.sh";
|
|
|
+ Runtime r = Runtime.getRuntime();
|
|
|
+ Process p;
|
|
|
+ try {
|
|
|
+ p = r.exec(command);
|
|
|
+ BufferedReader br = new BufferedReader(
|
|
|
+ new InputStreamReader(p.getInputStream()));
|
|
|
+ String inline;
|
|
|
+ while ((inline = br.readLine()) != null) {
|
|
|
+ log.info(inline);
|
|
|
+ }
|
|
|
+ log.info("---------pm烽火数据---汇总时间----出错信息--------");
|
|
|
+ BufferedReader br_error = new BufferedReader(
|
|
|
+ new InputStreamReader(p.getErrorStream()));
|
|
|
+ while ((inline = br_error.readLine()) != null) {
|
|
|
+ log.info(inline);
|
|
|
+ }
|
|
|
+ br.close();
|
|
|
+ br_error.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|