Browse Source

读取邮件统计设置 先进入 邮件测风塔

hxf 1 năm trước cách đây
mục cha
commit
0921cd6acd

+ 41 - 18
wrdep-biz/src/main/java/com/jiayue/biz/service/impl/AnalysisDataImpl.java

@@ -1229,6 +1229,26 @@ public class AnalysisDataImpl {
 
     }
 
+    public boolean windTowerInfoType(String id) {
+        List<WindTowerInfo> equipmentNo = windTowerInfoService.getByEquipmentNo(id);
+        List<EmailWindTowerInfo> emailWindTowerInfos = emailWindTowerInfoService.lambdaQuery().eq(EmailWindTowerInfo::getEquipmentNo, id).list();
+        if (equipmentNo.size() != 0 && emailWindTowerInfos.size() != 0) {
+            return true;
+        } else {
+            if (emailWindTowerInfos.size() == 0) {
+                //如果测风塔里面没有这个塔并且邮件测风塔里也没有这个塔 则添加到邮箱读取的测风塔表中
+                EmailWindTowerInfo emailWindTowerInfo = new EmailWindTowerInfo();
+                emailWindTowerInfo.setEquipmentNo(id);
+                emailWindTowerInfoService.save(emailWindTowerInfo);
+                log.info(id + " 测风塔信息里没有这个的塔 并且邮件测风塔里也没有这个塔");
+            }
+
+            return false;
+        }
+
+
+    }
+
     /**
      * dat文件解析
      */
@@ -1256,28 +1276,31 @@ public class AnalysisDataImpl {
             rowsOne.set(i, wsOrWdOrTOrRhOrPa);
         }
 
-
         List<WindTowerInfo> equipmentNo = windTowerInfoService.getByEquipmentNo(windTowerInfo.getEquipmentNo());
+        if (windTowerInfoType(windTowerInfo.getEquipmentNo())) {
+            if (equipmentNo.size() == 0) {
+                windTowerInfo.setHeights(height.toString());
+                windTowerInfo.setWdHeights(height.toString());
+                windTowerInfoService.saveOrUpdate(windTowerInfo);
+            }
+            List<Map<String, Object>> mapList = parseByHead(rows, rowsOne);
+            List<Map<String, Object>> mapList1 = new CheckDataRecode().checkValue(mapList, "dat");
+            windTowerDataParentTableService.packageData(mapList1, windTowerInfo.getEquipmentNo(), "dat", "");
+            //将后缀名修改回来
+            String newFileName = fileName.substring(0, fileName.lastIndexOf(".")) + ".dat";
+            File file1 = new File(dec + newFileName);
+            newFile.renameTo(file1);
+            try {
+                com.jiayue.biz.util.FileUtil.move(file1.getPath(), eolFilePath + File.separator + windTowerInfo.getEquipmentNo());
+            } catch (Exception e) {
+                log.info("dat文件转移失败");
+                throw new RuntimeException(e);
+            }
+
 
-        if (equipmentNo.size() == 0) {
-            windTowerInfo.setHeights(height.toString());
-            windTowerInfo.setWdHeights(height.toString());
-            windTowerInfoService.saveOrUpdate(windTowerInfo);
-        }
-        List<Map<String, Object>> mapList = parseByHead(rows, rowsOne);
-        List<Map<String, Object>> mapList1 = new CheckDataRecode().checkValue(mapList, "dat");
-        windTowerDataParentTableService.packageData(mapList1, windTowerInfo.getEquipmentNo(), "dat", "");
-        //将后缀名修改回来
-        String newFileName = fileName.substring(0, fileName.lastIndexOf(".")) + ".dat";
-        File file1 = new File(dec + newFileName);
-        newFile.renameTo(file1);
-        try {
-            com.jiayue.biz.util.FileUtil.move(file1.getPath(), eolFilePath + File.separator + windTowerInfo.getEquipmentNo());
-        } catch (Exception e) {
-            log.info("dat文件转移失败");
-            throw new RuntimeException(e);
         }
 
+
     }
 
     public List<Map<String, Object>> parseByHead(List<CsvRow> rows, CsvRow rowsOne) {

+ 9 - 2
wrdep-biz/src/main/java/com/jiayue/biz/service/impl/EmailImpl.java

@@ -476,7 +476,7 @@ public class EmailImpl extends ServiceImpl<EmailMapper, Email> implements EmailS
             //遍历所有文件
             File[] files = file.listFiles();
             for (File f : files) {
-                String type = f.getName().split("\\.")[1];
+                String type = f.getName().substring(f.getName().lastIndexOf(".") + 1);
 
                 if (type.equals("RWD")) {
                     //RWD文件类型
@@ -555,7 +555,14 @@ public class EmailImpl extends ServiceImpl<EmailMapper, Email> implements EmailS
                     analysisDataService.analysisData(type);
                 }else if(type.equals("csv")){
                     String id = subjectId.substring(subjectId.indexOf("[") + 1, subjectId.lastIndexOf("]"));
-                    analysisDataService.acousticRadar(f,id);
+                    List<WindTowerInfo> equipmentNo = windTowerInfoService.getByEquipmentNo(id);
+                    if(equipmentNo.size() == 0){
+                        windTowerInfoType(id,equipmentNo);
+                    }else {
+                        analysisDataService.acousticRadar(f,id);
+                    }
+
+
                 }else if(type.equals("dat")){
                     analysisDataService.parseByDat(f);
 

+ 3 - 8
wrdep-biz/src/main/java/com/jiayue/biz/service/impl/WindTowerInfoServiceImpl.java

@@ -50,11 +50,9 @@ public class WindTowerInfoServiceImpl extends ServiceImpl<WindTowerInfoMapper, W
 
     //获取所有测风塔信息
     public List<WindTowerInfo> getAllWindTower(){
-//        if(redisCache.getCacheObject("getAllWindTower") == null){
-//            redisCache.setCacheObject("getAllWindTower",this.list(),24, TimeUnit.HOURS);
-//        }
-//        redisCache.getCacheObject("getAllWindTower");
-        return this.list();
+
+
+        return this.lambdaQuery().list();
     }
 
     /**
@@ -66,14 +64,12 @@ public class WindTowerInfoServiceImpl extends ServiceImpl<WindTowerInfoMapper, W
     public boolean saveWindTowerInfo(WindTowerInfo windTowerInfo) {
         baseMapper.createCalculationTable("wind_tower_calculation_data_" + windTowerInfo.getEquipmentNo());
         boolean save = this.save(windTowerInfo);
-//        redisCache.setCacheObject("getAllWindTower",this.list(),24, TimeUnit.HOURS);
         return save;
     }
 
 
     public boolean update(WindTowerInfo windTowerInfo){
         boolean b = this.updateById(windTowerInfo);
-//        redisCache.setCacheObject("getAllWindTower",this.list(),24, TimeUnit.HOURS);
 
         return b;
     }
@@ -90,7 +86,6 @@ public class WindTowerInfoServiceImpl extends ServiceImpl<WindTowerInfoMapper, W
             baseMapper.deleteCalculationTable("wind_tower_calculation_data_" + w.getEquipmentNo());
         }
         boolean b = this.removeByIds(ids);
-//        redisCache.setCacheObject("getAllWindTower",this.list(),24, TimeUnit.HOURS);
         return b;
     }