Explorar el Código

加载基础信息镜像文件信息到缓存

jyyw hace 1 año
padre
commit
8eb64aa95f
Se han modificado 47 ficheros con 532 adiciones y 308 borrados
  1. 2 1
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/EquipmentAttribute.java
  2. 3 1
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/InitJobClass.java
  3. 2 1
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/ProtocolGatherDataPoint.java
  4. 3 1
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/Quartz.java
  5. 2 2
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/UploadFileCode.java
  6. 1 0
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/Spare2Application.java
  7. 5 4
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/base4/BaseRepository.java
  8. 13 1
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/base4/BaseService.java
  9. 8 11
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/AGC_AVCInfoRepository.java
  10. 8 10
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/BoosterStationInfoRepository.java
  11. 7 25
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/ElectricFieldRepository.java
  12. 9 10
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/EquipmentAttributeRepository.java
  13. 8 11
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/Gather104TcpTunnelInfoRepository.java
  14. 8 11
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/InitJobClassRepository.java
  15. 9 11
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/InverterInfoRepository.java
  16. 8 11
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/ProtocolGatherDataPointRepository.java
  17. 8 11
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/PvModuleModelRepository.java
  18. 8 11
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/QuartzRepository.java
  19. 8 11
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/SysParameterRepository.java
  20. 8 11
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/UploadFileChannelRepository.java
  21. 8 11
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/UploadFileCodeRepository.java
  22. 8 11
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/UploadObjectRepository.java
  23. 8 11
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/WeatherStationInfoRepository.java
  24. 8 11
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/WindTowerInfoRepository.java
  25. 8 11
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/WindTurbineInfoRepository.java
  26. 13 4
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/AGC_AVCInfoService.java
  27. 13 4
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/BoosterStationInfoService.java
  28. 11 8
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/ElectricFieldService.java
  29. 16 5
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/EquipmentAttributeService.java
  30. 13 4
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/Gather104TcpTunnelInfoService.java
  31. 78 0
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/ImageLoadeService.java
  32. 14 4
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/InitJobClassService.java
  33. 15 4
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/InverterInfoService.java
  34. 15 4
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/ProtocolGatherDataPointService.java
  35. 14 4
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/PvModuleModelService.java
  36. 15 4
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/QuartzService.java
  37. 15 4
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/SysParameterService.java
  38. 15 4
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/UploadFileChannelService.java
  39. 15 4
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/UploadFileCodeService.java
  40. 0 28
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/UploadObiectService.java
  41. 39 0
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/UploadObjectService.java
  42. 15 4
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/WeatherStationInfoService.java
  43. 15 4
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/WindTowerInfoService.java
  44. 15 4
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/WindTurbineInfoService.java
  45. 8 1
      ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/job/ConsoleCheckUpJob.java
  46. 3 0
      ipfcst-spare2/src/main/resources/application.yml
  47. 7 0
      ipfcst-spare2/src/main/resources/ehcache-setting.xml

+ 2 - 1
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/EquipmentAttribute.java

@@ -5,6 +5,7 @@ import lombok.Data;
 import org.hibernate.annotations.GenericGenerator;
 
 import javax.persistence.*;
+import java.io.Serializable;
 
 /**
  * 各个装备的属性值提取出来
@@ -14,7 +15,7 @@ import javax.persistence.*;
  */
 @Data
 @Entity
-public class EquipmentAttribute {
+public class EquipmentAttribute implements Serializable {
 
     /**
      * Id

+ 3 - 1
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/InitJobClass.java

@@ -1,10 +1,12 @@
 package com.jiayue.ipfcst.common.data.entity;
 
+import com.jiayue.ipfcst.common.data.abst.AbstractBaseEntity;
 import lombok.Data;
 import org.hibernate.annotations.GenericGenerator;
 import org.springframework.core.annotation.Order;
 
 import javax.persistence.*;
+import java.io.Serializable;
 
 /**
  * InitJobClass
@@ -15,7 +17,7 @@ import javax.persistence.*;
  */
 @Entity
 @Data
-public class InitJobClass {
+public class InitJobClass implements Serializable {
 
     @Id
     @Order(1)

+ 2 - 1
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/ProtocolGatherDataPoint.java

@@ -6,6 +6,7 @@ import lombok.Data;
 import org.hibernate.annotations.GenericGenerator;
 
 import javax.persistence.*;
+import java.io.Serializable;
 
 /**
  * 协议数据点表
@@ -15,7 +16,7 @@ import javax.persistence.*;
  */
 @Data
 @Entity
-public class ProtocolGatherDataPoint {
+public class ProtocolGatherDataPoint implements Serializable {
 
     /**
      * id主键

+ 3 - 1
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/Quartz.java

@@ -1,10 +1,12 @@
 package com.jiayue.ipfcst.common.data.entity;
 
+import com.jiayue.ipfcst.common.data.abst.AbstractBaseEntity;
 import lombok.Data;
 import org.hibernate.annotations.GenericGenerator;
 import org.springframework.core.annotation.Order;
 
 import javax.persistence.*;
+import java.io.Serializable;
 import java.util.Date;
 
 /**
@@ -16,7 +18,7 @@ import java.util.Date;
  */
 @Data
 @Entity
-public class Quartz {
+public class Quartz implements Serializable {
 
     @Id
     @Order(1)

+ 2 - 2
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/UploadFileCode.java

@@ -6,6 +6,7 @@ import org.hibernate.annotations.GenericGenerator;
 import org.springframework.core.annotation.Order;
 
 import javax.persistence.*;
+import java.io.Serializable;
 
 /**
  * 上报文件CODE码
@@ -15,8 +16,7 @@ import javax.persistence.*;
  */
 @Data
 @Entity
-public class UploadFileCode {
-    private static final long serialVersionUID = 1L;
+public class UploadFileCode  implements Serializable {
 
     @Id
     @Order(1)

+ 1 - 0
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/Spare2Application.java

@@ -65,6 +65,7 @@ public class Spare2Application {
     public EhCacheManagerFactoryBean cacheManagerFactory() {
         EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean();
         ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache-setting.xml"));
+        ehCacheManagerFactoryBean.setShared(false);
         return ehCacheManagerFactoryBean;
     }
 

+ 5 - 4
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/base4/BaseRepository.java

@@ -2,7 +2,6 @@ package com.jiayue.ipfcst.spare2.base4;
 
 import com.jiayue.ipfcst.spare2.util.FileUtil;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.Cache;
 import org.springframework.cache.ehcache.EhCacheCacheManager;
 import org.springframework.stereotype.Repository;
 
@@ -19,13 +18,15 @@ public class BaseRepository implements Serializable {
         return new Exception("基础信息:镜像文件" + t.getSimpleName() + "内容为空,无法启动程序");
     }
 
+    public <T> Exception newImageCacheContentEmptyException(Class<T> t) {
+        return new Exception("基础信息:镜像缓存" + t.getSimpleName() + "内容为空,无法启动程序");
+    }
+
     public <T> List<T> readImageToList(Class<T> clazz) throws Exception {
         List<T> list = (List<T>) FileUtil.readBaseInfoImage(clazz.getSimpleName());
-        if (null != list) {
+        if (null == list) {
             throw newImageFileContentEmptyException(clazz);
         }
-        Cache cache = ehCacheCacheManager.getCache(clazz.getSimpleName());
-        cache.put("list", list);
         return list;
     }
 }

+ 13 - 1
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/base4/BaseService.java

@@ -1,4 +1,16 @@
 package com.jiayue.ipfcst.spare2.base4;
 
-public class BaseService {
+import com.jiayue.ipfcst.spare2.baseinfos.service.SysParameterService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.ehcache.EhCacheCacheManager;
+
+import java.io.Serializable;
+
+public class BaseService implements Serializable {
+
+    @Autowired
+    public EhCacheCacheManager ehCacheCacheManager;
+
+    @Autowired
+    public SysParameterService sysParameterService;
 }

+ 8 - 11
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/AGC_AVCInfoRepository.java

@@ -2,6 +2,7 @@ package com.jiayue.ipfcst.spare2.baseinfos.repository;
 
 import com.jiayue.ipfcst.common.data.entity.AGC_AVCInfo;
 import com.jiayue.ipfcst.spare2.base4.BaseRepository;
+import org.springframework.cache.Cache;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
 import org.springframework.cache.annotation.Cacheable;
@@ -12,19 +13,15 @@ import java.util.List;
 @Repository
 public class AGC_AVCInfoRepository extends BaseRepository {
 
-    @Cacheable(cacheNames = "AGC_AVCInfo", key = "#agcAvcInfoList")
-    public AGC_AVCInfo findById() {
-        return null;
+    @Cacheable(value = "spare2", key = "#agcAvcInfoList")
+    public List<AGC_AVCInfo> findAll(String agcAvcInfoList) throws Exception {
+        return fresh(agcAvcInfoList);
     }
 
-    @Cacheable(cacheNames = "AGC_AVCInfo", key = "#agcAvcInfoList")
-    public List<AGC_AVCInfo> findAll() {
-        return null;
-    }
-
-    @CacheEvict(value = "AGC_AVCInfo", beforeInvocation = true)
-    @CachePut(cacheNames = "AGC_AVCInfo", key = "#agcAvcInfoList")
-    private List<AGC_AVCInfo> fresh() throws Exception {
+    @CacheEvict(value = "spare2", key = "#agcAvcInfoList", beforeInvocation = true)
+    @CachePut(value = "spare2", key = "#agcAvcInfoList")
+    public List<AGC_AVCInfo> fresh(String agcAvcInfoList) throws Exception {
         return readImageToList(AGC_AVCInfo.class);
     }
+
 }

+ 8 - 10
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/BoosterStationInfoRepository.java

@@ -2,6 +2,7 @@ package com.jiayue.ipfcst.spare2.baseinfos.repository;
 
 import com.jiayue.ipfcst.common.data.entity.BoosterStationInfo;
 import com.jiayue.ipfcst.spare2.base4.BaseRepository;
+import org.springframework.cache.Cache;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
 import org.springframework.cache.annotation.Cacheable;
@@ -12,19 +13,16 @@ import java.util.List;
 @Repository
 public class BoosterStationInfoRepository extends BaseRepository {
 
-    @Cacheable(cacheNames = "BoosterStationInfo", key = "#boosterStationInfoList")
-    public BoosterStationInfo findById() {
-        return null;
-    }
 
-    @Cacheable(cacheNames = "BoosterStationInfo", key = "#boosterStationInfoList")
-    public List<BoosterStationInfo> findAll() {
-        return null;
+    @Cacheable(value = "spare2", key = "#boosterStationInfoList")
+    public List<BoosterStationInfo> findAll(String boosterStationInfoList) throws Exception {
+        return fresh(boosterStationInfoList);
     }
 
-    @CacheEvict(value = "BoosterStationInfo", beforeInvocation = true)
-    @CachePut(cacheNames = "BoosterStationInfo", key = "#boosterStationInfoList")
-    private List<BoosterStationInfo> fresh() throws Exception {
+    @CacheEvict(value = "spare2", key = "#boosterStationInfoList", beforeInvocation = true)
+    @CachePut(value = "spare2", key = "#boosterStationInfoList")
+    public List<BoosterStationInfo> fresh(String boosterStationInfoList) throws Exception {
         return readImageToList(BoosterStationInfo.class);
     }
+
 }

+ 7 - 25
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/ElectricFieldRepository.java

@@ -8,38 +8,20 @@ import org.springframework.cache.annotation.CachePut;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Repository;
 
-import java.util.ArrayList;
 import java.util.List;
-import java.util.Optional;
 
 @Repository
 public class ElectricFieldRepository extends BaseRepository {
 
-    @Cacheable(cacheNames = "ElectricField", key = "#electricFieldList")
-    public ElectricField findFirst() {
-        List<ElectricField> list = findAll();
-        Optional<ElectricField> optional = list.stream().findFirst();
-        return optional.orElse(null);
+    @Cacheable(value = "spare2", key = "#electricFieldList")
+    public List<ElectricField> findAll(String electricFieldList) throws Exception {
+        return fresh(electricFieldList);
     }
 
-    @Cacheable(cacheNames = "ElectricField", key = "#electricFieldList")
-    public ElectricField findByStationCode(String stationCode) {
-        List<ElectricField> list = findAll();
-        Optional<ElectricField> optional = list.stream().filter(t -> t.getStationCode().equals(stationCode)).findFirst();
-        return optional.orElse(null);
-    }
-
-    @Cacheable(cacheNames = "ElectricField", key = "#electricFieldList")
-    public List<ElectricField> findAll() {
-        List<ElectricField> result = new ArrayList<>();
-        Cache cache = ehCacheCacheManager.getCache("ElectricField");
-        result = (List<ElectricField>) cache.get("list");
-        return result;
-    }
-
-    @CacheEvict(value = "ElectricField", beforeInvocation = true)
-    @CachePut(cacheNames = "ElectricField", key = "#electricFieldList")
-    private List<ElectricField> fresh() throws Exception {
+    @CacheEvict(value = "spare2", key = "#electricFieldList", beforeInvocation = true)
+    @CachePut(value = "spare2", key = "#electricFieldList")
+    public List<ElectricField> fresh(String electricFieldList) throws Exception {
         return readImageToList(ElectricField.class);
     }
+
 }

+ 9 - 10
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/EquipmentAttributeRepository.java

@@ -1,7 +1,9 @@
 package com.jiayue.ipfcst.spare2.baseinfos.repository;
 
 import com.jiayue.ipfcst.common.data.entity.EquipmentAttribute;
+import com.jiayue.ipfcst.common.data.entity.EquipmentAttribute;
 import com.jiayue.ipfcst.spare2.base4.BaseRepository;
+import org.springframework.cache.Cache;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
 import org.springframework.cache.annotation.Cacheable;
@@ -12,19 +14,16 @@ import java.util.List;
 @Repository
 public class EquipmentAttributeRepository extends BaseRepository {
 
-    @Cacheable(cacheNames = "EquipmentAttribute", key = "#equipmentAttributeList")
-    public EquipmentAttribute findById() {
-        return null;
-    }
 
-    @Cacheable(cacheNames = "EquipmentAttribute", key = "#equipmentAttributeList")
-    public List<EquipmentAttribute> findAll() {
-        return null;
+    @Cacheable(value = "spare2", key = "#equipmentAttributeList")
+    public List<EquipmentAttribute> findAll(String equipmentAttributeList) throws Exception {
+        return fresh(equipmentAttributeList);
     }
 
-    @CacheEvict(value = "EquipmentAttribute", beforeInvocation = true)
-    @CachePut(cacheNames = "EquipmentAttribute", key = "#equipmentAttributeList")
-    private List<EquipmentAttribute> fresh() throws Exception {
+    @CacheEvict(value = "spare2", key = "#equipmentAttributeList", beforeInvocation = true)
+    @CachePut(value = "spare2", key = "#equipmentAttributeList")
+    public List<EquipmentAttribute> fresh(String equipmentAttributeList) throws Exception {
         return readImageToList(EquipmentAttribute.class);
     }
+
 }

+ 8 - 11
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/Gather104TcpTunnelInfoRepository.java

@@ -2,6 +2,7 @@ package com.jiayue.ipfcst.spare2.baseinfos.repository;
 
 import com.jiayue.ipfcst.common.data.entity.gathertunnelinfo.Gather104TcpTunnelInfo;
 import com.jiayue.ipfcst.spare2.base4.BaseRepository;
+import org.springframework.cache.Cache;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
 import org.springframework.cache.annotation.Cacheable;
@@ -12,19 +13,15 @@ import java.util.List;
 @Repository
 public class Gather104TcpTunnelInfoRepository extends BaseRepository {
 
-    @Cacheable(cacheNames = "Gather104TcpTunnelInfo", key = "#gather104TcpTunnelInfoList")
-    public Gather104TcpTunnelInfo findById() {
-        return null;
+    @Cacheable(value = "spare2", key = "#gather104TcpTunnelInfoList")
+    public List<Gather104TcpTunnelInfo> findAll(String gather104TcpTunnelInfoList) throws Exception {
+        return fresh(gather104TcpTunnelInfoList);
     }
 
-    @Cacheable(cacheNames = "Gather104TcpTunnelInfo", key = "#gather104TcpTunnelInfoList")
-    public List<Gather104TcpTunnelInfo> findAll() {
-        return null;
-    }
-
-    @CacheEvict(value = "Gather104TcpTunnelInfo", beforeInvocation = true)
-    @CachePut(cacheNames = "Gather104TcpTunnelInfo", key = "#gather104TcpTunnelInfoList")
-    private List<Gather104TcpTunnelInfo> fresh() throws Exception {
+    @CacheEvict(value = "spare2", key = "#gather104TcpTunnelInfoList", beforeInvocation = true)
+    @CachePut(value = "spare2", key = "#gather104TcpTunnelInfoList")
+    public List<Gather104TcpTunnelInfo> fresh(String gather104TcpTunnelInfoList) throws Exception {
         return readImageToList(Gather104TcpTunnelInfo.class);
     }
+
 }

+ 8 - 11
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/InitJobClassRepository.java

@@ -2,6 +2,7 @@ package com.jiayue.ipfcst.spare2.baseinfos.repository;
 
 import com.jiayue.ipfcst.common.data.entity.InitJobClass;
 import com.jiayue.ipfcst.spare2.base4.BaseRepository;
+import org.springframework.cache.Cache;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
 import org.springframework.cache.annotation.Cacheable;
@@ -12,19 +13,15 @@ import java.util.List;
 @Repository
 public class InitJobClassRepository extends BaseRepository {
 
-    @Cacheable(cacheNames = "InitJobClass", key = "#initJobClassList")
-    public InitJobClass findById() {
-        return null;
+    @Cacheable(value = "spare2", key = "#initJobClassList")
+    public List<InitJobClass> findAll(String initJobClassList) throws Exception {
+        return fresh(initJobClassList);
     }
 
-    @Cacheable(cacheNames = "InitJobClass", key = "#initJobClassList")
-    public List<InitJobClass> findAll() {
-        return null;
-    }
-
-    @CacheEvict(value = "InitJobClass", beforeInvocation = true)
-    @CachePut(cacheNames = "InitJobClass", key = "#initJobClassList")
-    private List<InitJobClass> fresh() throws Exception {
+    @CacheEvict(value = "spare2", key = "#initJobClassList", beforeInvocation = true)
+    @CachePut(value = "spare2", key = "#initJobClassList")
+    public List<InitJobClass> fresh(String initJobClassList) throws Exception {
         return readImageToList(InitJobClass.class);
     }
+
 }

+ 9 - 11
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/InverterInfoRepository.java

@@ -1,7 +1,9 @@
 package com.jiayue.ipfcst.spare2.baseinfos.repository;
 
 import com.jiayue.ipfcst.common.data.entity.InverterInfo;
+import com.jiayue.ipfcst.common.data.entity.InverterInfo;
 import com.jiayue.ipfcst.spare2.base4.BaseRepository;
+import org.springframework.cache.Cache;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
 import org.springframework.cache.annotation.Cacheable;
@@ -12,19 +14,15 @@ import java.util.List;
 @Repository
 public class InverterInfoRepository extends BaseRepository {
 
-    @Cacheable(cacheNames = "InverterInfo", key = "#inverterInfoList")
-    public InverterInfo findById() {
-        return null;
-    }
-
-    @Cacheable(cacheNames = "InverterInfo", key = "#inverterInfoList")
-    public List<InverterInfo> findAll() {
-        return null;
+    @Cacheable(value = "spare2", key = "#inverterInfoList")
+    public List<InverterInfo> findAll(String inverterInfoList) throws Exception {
+        return fresh(inverterInfoList);
     }
 
-    @CacheEvict(value = "InverterInfo", beforeInvocation = true)
-    @CachePut(cacheNames = "InverterInfo", key = "#inverterInfoList")
-    private List<InverterInfo> fresh() throws Exception {
+    @CacheEvict(value = "spare2", key = "#inverterInfoList", beforeInvocation = true)
+    @CachePut(value = "spare2", key = "#inverterInfoList")
+    public List<InverterInfo> fresh(String inverterInfoList) throws Exception {
         return readImageToList(InverterInfo.class);
     }
+
 }

+ 8 - 11
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/ProtocolGatherDataPointRepository.java

@@ -1,6 +1,7 @@
 package com.jiayue.ipfcst.spare2.baseinfos.repository;
 
 import com.jiayue.ipfcst.common.data.entity.ProtocolGatherDataPoint;
+import com.jiayue.ipfcst.common.data.entity.ProtocolGatherDataPoint;
 import com.jiayue.ipfcst.spare2.base4.BaseRepository;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
@@ -12,19 +13,15 @@ import java.util.List;
 @Repository
 public class ProtocolGatherDataPointRepository extends BaseRepository {
 
-    @Cacheable(cacheNames = "ProtocolGatherDataPoint", key = "#protocolGatherDataPointList")
-    public ProtocolGatherDataPoint findById() {
-        return null;
-    }
-
-    @Cacheable(cacheNames = "ProtocolGatherDataPoint", key = "#protocolGatherDataPointList")
-    public List<ProtocolGatherDataPoint> findAll() {
-        return null;
+    @Cacheable(value = "spare2", key = "#protocolGatherDataPointList")
+    public List<ProtocolGatherDataPoint> findAll(String protocolGatherDataPointList) throws Exception {
+        return fresh(protocolGatherDataPointList);
     }
 
-    @CacheEvict(value = "ProtocolGatherDataPoint", beforeInvocation = true)
-    @CachePut(cacheNames = "ProtocolGatherDataPoint", key = "#protocolGatherDataPointList")
-    private List<ProtocolGatherDataPoint> fresh() throws Exception {
+    @CacheEvict(value = "spare2", key = "#protocolGatherDataPointList", beforeInvocation = true)
+    @CachePut(value = "spare2", key = "#protocolGatherDataPointList")
+    public List<ProtocolGatherDataPoint> fresh(String protocolGatherDataPointList) throws Exception {
         return readImageToList(ProtocolGatherDataPoint.class);
     }
+
 }

+ 8 - 11
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/PvModuleModelRepository.java

@@ -1,6 +1,7 @@
 package com.jiayue.ipfcst.spare2.baseinfos.repository;
 
 import com.jiayue.ipfcst.common.data.entity.PvModuleModel;
+import com.jiayue.ipfcst.common.data.entity.PvModuleModel;
 import com.jiayue.ipfcst.spare2.base4.BaseRepository;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
@@ -12,19 +13,15 @@ import java.util.List;
 @Repository
 public class PvModuleModelRepository extends BaseRepository {
 
-    @Cacheable(cacheNames = "PvModuleModel", key = "#pvModuleModelList")
-    public PvModuleModel findById() {
-        return null;
-    }
-
-    @Cacheable(cacheNames = "PvModuleModel", key = "#pvModuleModelList")
-    public List<PvModuleModel> findAll() {
-        return null;
+    @Cacheable(value = "spare2", key = "#pvModuleModelList")
+    public List<PvModuleModel> findAll(String pvModuleModelList) throws Exception {
+        return fresh(pvModuleModelList);
     }
 
-    @CacheEvict(value = "PvModuleModel", beforeInvocation = true)
-    @CachePut(cacheNames = "PvModuleModel", key = "#pvModuleModelList")
-    private List<PvModuleModel> fresh() throws Exception {
+    @CacheEvict(value = "spare2", key = "#pvModuleModelList", beforeInvocation = true)
+    @CachePut(value = "spare2", key = "#pvModuleModelList")
+    public List<PvModuleModel> fresh(String pvModuleModelList) throws Exception {
         return readImageToList(PvModuleModel.class);
     }
+
 }

+ 8 - 11
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/QuartzRepository.java

@@ -2,6 +2,7 @@ package com.jiayue.ipfcst.spare2.baseinfos.repository;
 
 import com.jiayue.ipfcst.common.data.entity.ElectricField;
 import com.jiayue.ipfcst.common.data.entity.Quartz;
+import com.jiayue.ipfcst.common.data.entity.Quartz;
 import com.jiayue.ipfcst.spare2.base4.BaseRepository;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
@@ -13,19 +14,15 @@ import java.util.List;
 @Repository
 public class QuartzRepository extends BaseRepository {
 
-    @Cacheable(cacheNames = "Quartz", key = "#quartzList")
-    public Quartz findById() {
-        return null;
+    @Cacheable(value = "spare2", key = "#quartzList")
+    public List<Quartz> findAll(String quartzList) throws Exception {
+        return fresh(quartzList);
     }
 
-    @Cacheable(cacheNames = "Quartz", key = "#quartzList")
-    public List<Quartz> findAll() {
-        return null;
+    @CacheEvict(value = "spare2", key = "#quartzList", beforeInvocation = true)
+    @CachePut(value = "spare2", key = "#quartzList")
+    public List<Quartz> fresh(String quartzList) throws Exception {
+        return readImageToList(Quartz.class);
     }
 
-    @CacheEvict(value = "ElectricField", beforeInvocation = true)
-    @CachePut(cacheNames = "ElectricField", key = "#electricFieldList")
-    private List<ElectricField> fresh() throws Exception {
-        return readImageToList(ElectricField.class);
-    }
 }

+ 8 - 11
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/SysParameterRepository.java

@@ -1,6 +1,7 @@
 package com.jiayue.ipfcst.spare2.baseinfos.repository;
 
 import com.jiayue.ipfcst.common.data.entity.SysParameter;
+import com.jiayue.ipfcst.common.data.entity.SysParameter;
 import com.jiayue.ipfcst.spare2.base4.BaseRepository;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
@@ -12,19 +13,15 @@ import java.util.List;
 @Repository
 public class SysParameterRepository extends BaseRepository {
 
-    @Cacheable(cacheNames = "SysParameter", key = "#sysParameterList")
-    public SysParameter findById() {
-        return null;
-    }
-
-    @Cacheable(cacheNames = "SysParameter", key = "#sysParameterList")
-    public List<SysParameter> findAll() {
-        return null;
+    @Cacheable(value = "spare2", key = "#sysParameterList")
+    public List<SysParameter> findAll(String sysParameterList) throws Exception {
+        return fresh(sysParameterList);
     }
 
-    @CacheEvict(value = "SysParameter", beforeInvocation = true)
-    @CachePut(cacheNames = "SysParameter", key = "#sysParameterList")
-    private List<SysParameter> fresh() throws Exception {
+    @CacheEvict(value = "spare2", key = "#sysParameterList", beforeInvocation = true)
+    @CachePut(value = "spare2", key = "#sysParameterList")
+    public List<SysParameter> fresh(String sysParameterList) throws Exception {
         return readImageToList(SysParameter.class);
     }
+
 }

+ 8 - 11
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/UploadFileChannelRepository.java

@@ -1,6 +1,7 @@
 package com.jiayue.ipfcst.spare2.baseinfos.repository;
 
 import com.jiayue.ipfcst.common.data.entity.UploadFileChannel;
+import com.jiayue.ipfcst.common.data.entity.UploadFileChannel;
 import com.jiayue.ipfcst.spare2.base4.BaseRepository;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
@@ -12,19 +13,15 @@ import java.util.List;
 @Repository
 public class UploadFileChannelRepository extends BaseRepository {
 
-    @Cacheable(cacheNames = "UploadFileChannel", key = "#uploadFileChannelList")
-    public UploadFileChannel findById() {
-        return null;
-    }
-
-    @Cacheable(cacheNames = "UploadFileChannel", key = "#uploadFileChannelList")
-    public List<UploadFileChannel> findAll() {
-        return null;
+    @Cacheable(value = "spare2", key = "#uploadFileChannelList")
+    public List<UploadFileChannel> findAll(String uploadFileChannelList) throws Exception {
+        return fresh(uploadFileChannelList);
     }
 
-    @CacheEvict(value = "UploadFileChannel", beforeInvocation = true)
-    @CachePut(cacheNames = "UploadFileChannel", key = "#uploadFileChannelList")
-    private List<UploadFileChannel> fresh() throws Exception {
+    @CacheEvict(value = "spare2", key = "#uploadFileChannelList", beforeInvocation = true)
+    @CachePut(value = "spare2", key = "#uploadFileChannelList")
+    public List<UploadFileChannel> fresh(String uploadFileChannelList) throws Exception {
         return readImageToList(UploadFileChannel.class);
     }
+
 }

+ 8 - 11
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/UploadFileCodeRepository.java

@@ -1,6 +1,7 @@
 package com.jiayue.ipfcst.spare2.baseinfos.repository;
 
 import com.jiayue.ipfcst.common.data.entity.UploadFileCode;
+import com.jiayue.ipfcst.common.data.entity.UploadFileCode;
 import com.jiayue.ipfcst.spare2.base4.BaseRepository;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
@@ -12,19 +13,15 @@ import java.util.List;
 @Repository
 public class UploadFileCodeRepository extends BaseRepository {
 
-    @Cacheable(cacheNames = "UploadFileCode", key = "#uploadFileCodeList")
-    public UploadFileCode findById() {
-        return null;
-    }
-
-    @Cacheable(cacheNames = "UploadFileCode", key = "#uploadFileCodeList")
-    public List<UploadFileCode> findAll() {
-        return null;
+    @Cacheable(value = "spare2", key = "#uploadFileCodeList")
+    public List<UploadFileCode> findAll(String uploadFileCodeList) throws Exception {
+        return fresh(uploadFileCodeList);
     }
 
-    @CacheEvict(value = "UploadFileCode", beforeInvocation = true)
-    @CachePut(cacheNames = "UploadFileCode", key = "#uploadFileCodeList")
-    private List<UploadFileCode> fresh() throws Exception {
+    @CacheEvict(value = "spare2", key = "#uploadFileCodeList", beforeInvocation = true)
+    @CachePut(value = "spare2", key = "#uploadFileCodeList")
+    public List<UploadFileCode> fresh(String uploadFileCodeList) throws Exception {
         return readImageToList(UploadFileCode.class);
     }
+
 }

+ 8 - 11
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/UploadObjectRepository.java

@@ -1,6 +1,7 @@
 package com.jiayue.ipfcst.spare2.baseinfos.repository;
 
 import com.jiayue.ipfcst.common.data.entity.UploadObject;
+import com.jiayue.ipfcst.common.data.entity.UploadObject;
 import com.jiayue.ipfcst.spare2.base4.BaseRepository;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
@@ -12,19 +13,15 @@ import java.util.List;
 @Repository
 public class UploadObjectRepository extends BaseRepository {
 
-    @Cacheable(cacheNames = "UploadObject", key = "#uploadObjectList")
-    public UploadObject findById() {
-        return null;
-    }
-
-    @Cacheable(cacheNames = "UploadObject", key = "#uploadObjectList")
-    public List<UploadObject> findAll() {
-        return null;
+    @Cacheable(value = "spare2", key = "#uploadObjectList")
+    public List<UploadObject> findAll(String uploadObjectList) throws Exception {
+        return fresh(uploadObjectList);
     }
 
-    @CacheEvict(value = "UploadObject", beforeInvocation = true)
-    @CachePut(cacheNames = "UploadObject", key = "#uploadObjectList")
-    private List<UploadObject> fresh() throws Exception {
+    @CacheEvict(value = "spare2", key = "#uploadObjectList", beforeInvocation = true)
+    @CachePut(value = "spare2", key = "#uploadObjectList")
+    public List<UploadObject> fresh(String uploadObjectList) throws Exception {
         return readImageToList(UploadObject.class);
     }
+
 }

+ 8 - 11
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/WeatherStationInfoRepository.java

@@ -1,6 +1,7 @@
 package com.jiayue.ipfcst.spare2.baseinfos.repository;
 
 import com.jiayue.ipfcst.common.data.entity.WeatherStationInfo;
+import com.jiayue.ipfcst.common.data.entity.WeatherStationInfo;
 import com.jiayue.ipfcst.spare2.base4.BaseRepository;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
@@ -12,19 +13,15 @@ import java.util.List;
 @Repository
 public class WeatherStationInfoRepository extends BaseRepository {
 
-    @Cacheable(cacheNames = "WeatherStationInfo", key = "#weatherStationInfoList")
-    public WeatherStationInfo findById() {
-        return null;
-    }
-
-    @Cacheable(cacheNames = "WeatherStationInfo", key = "#weatherStationInfoList")
-    public List<WeatherStationInfo> findAll() {
-        return null;
+    @Cacheable(value = "spare2", key = "#weatherStationInfoList")
+    public List<WeatherStationInfo> findAll(String weatherStationInfoList) throws Exception {
+        return fresh(weatherStationInfoList);
     }
 
-    @CacheEvict(value = "WeatherStationInfo", beforeInvocation = true)
-    @CachePut(cacheNames = "WeatherStationInfo", key = "#weatherStationInfoList")
-    private List<WeatherStationInfo> fresh() throws Exception {
+    @CacheEvict(value = "spare2", key = "#weatherStationInfoList", beforeInvocation = true)
+    @CachePut(value = "spare2", key = "#weatherStationInfoList")
+    public List<WeatherStationInfo> fresh(String weatherStationInfoList) throws Exception {
         return readImageToList(WeatherStationInfo.class);
     }
+
 }

+ 8 - 11
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/WindTowerInfoRepository.java

@@ -1,6 +1,7 @@
 package com.jiayue.ipfcst.spare2.baseinfos.repository;
 
 import com.jiayue.ipfcst.common.data.entity.WindTowerInfo;
+import com.jiayue.ipfcst.common.data.entity.WindTowerInfo;
 import com.jiayue.ipfcst.spare2.base4.BaseRepository;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
@@ -12,19 +13,15 @@ import java.util.List;
 @Repository
 public class WindTowerInfoRepository extends BaseRepository {
 
-    @Cacheable(cacheNames = "WindTowerInfo", key = "#windTowerInfoList")
-    public WindTowerInfo findById() {
-        return null;
-    }
-
-    @Cacheable(cacheNames = "WindTowerInfo", key = "#windTowerInfoList")
-    public List<WindTowerInfo> findAll() {
-        return null;
+    @Cacheable(value = "spare2", key = "#windTowerInfoList")
+    public List<WindTowerInfo> findAll(String windTowerInfoList) throws Exception {
+        return fresh(windTowerInfoList);
     }
 
-    @CacheEvict(value = "WindTowerInfo", beforeInvocation = true)
-    @CachePut(cacheNames = "WindTowerInfo", key = "#windTowerInfoList")
-    private List<WindTowerInfo> fresh() throws Exception {
+    @CacheEvict(value = "spare2", key = "#windTowerInfoList", beforeInvocation = true)
+    @CachePut(value = "spare2", key = "#windTowerInfoList")
+    public List<WindTowerInfo> fresh(String windTowerInfoList) throws Exception {
         return readImageToList(WindTowerInfo.class);
     }
+
 }

+ 8 - 11
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/repository/WindTurbineInfoRepository.java

@@ -1,6 +1,7 @@
 package com.jiayue.ipfcst.spare2.baseinfos.repository;
 
 import com.jiayue.ipfcst.common.data.entity.WindTurbineInfo;
+import com.jiayue.ipfcst.common.data.entity.WindTurbineInfo;
 import com.jiayue.ipfcst.spare2.base4.BaseRepository;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
@@ -12,19 +13,15 @@ import java.util.List;
 @Repository
 public class WindTurbineInfoRepository extends BaseRepository {
 
-    @Cacheable(cacheNames = "WindTurbineInfo", key = "#windTurbineInfoList")
-    public WindTurbineInfo findById() {
-        return null;
-    }
-
-    @Cacheable(cacheNames = "WindTurbineInfo", key = "#windTurbineInfoList")
-    public List<WindTurbineInfo> findAll() {
-        return null;
+    @Cacheable(value = "spare2", key = "#windTurbineInfoList")
+    public List<WindTurbineInfo> findAll(String windTurbineInfoList) throws Exception {
+        return fresh(windTurbineInfoList);
     }
 
-    @CacheEvict(value = "WindTurbineInfo", beforeInvocation = true)
-    @CachePut(cacheNames = "WindTurbineInfo", key = "#windTurbineInfoList")
-    private List<WindTurbineInfo> fresh() throws Exception {
+    @CacheEvict(value = "spare2", key = "#windTurbineInfoList", beforeInvocation = true)
+    @CachePut(value = "spare2", key = "#windTurbineInfoList")
+    public List<WindTurbineInfo> fresh(String windTurbineInfoList) throws Exception {
         return readImageToList(WindTurbineInfo.class);
     }
+
 }

+ 13 - 4
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/AGC_AVCInfoService.java

@@ -1,5 +1,6 @@
 package com.jiayue.ipfcst.spare2.baseinfos.service;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.jiayue.ipfcst.common.data.entity.AGC_AVCInfo;
 import com.jiayue.ipfcst.spare2.base4.BaseService;
 import com.jiayue.ipfcst.spare2.baseinfos.repository.AGC_AVCInfoRepository;
@@ -8,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
 @Slf4j
@@ -16,13 +18,20 @@ public class AGC_AVCInfoService extends BaseService {
     @Autowired
     AGC_AVCInfoRepository agcAvcInfoRepository;
 
-    public AGC_AVCInfo findById() {
-        return agcAvcInfoRepository.findById();
+    private final String cacheKey = AGC_AVCInfo.class.getSimpleName();
+
+    public AGC_AVCInfo findById(String id) throws Exception {
+        List<AGC_AVCInfo> list = findAll();
+        Optional<AGC_AVCInfo> optional = list.stream().filter(t -> ObjectUtil.equal(t.getId(), id)).findFirst();
+        return optional.orElse(null);
     }
 
-    public List<AGC_AVCInfo> findAll() {
-        return agcAvcInfoRepository.findAll();
+    public List<AGC_AVCInfo> findAll() throws Exception {
+        return agcAvcInfoRepository.findAll(cacheKey);
     }
 
+    public List<AGC_AVCInfo> fresh() throws Exception {
+        return agcAvcInfoRepository.fresh(cacheKey);
+    }
 
 }

+ 13 - 4
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/BoosterStationInfoService.java

@@ -1,5 +1,6 @@
 package com.jiayue.ipfcst.spare2.baseinfos.service;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.jiayue.ipfcst.common.data.entity.BoosterStationInfo;
 import com.jiayue.ipfcst.spare2.base4.BaseService;
 import com.jiayue.ipfcst.spare2.baseinfos.repository.BoosterStationInfoRepository;
@@ -8,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
 @Slf4j
@@ -16,13 +18,20 @@ public class BoosterStationInfoService extends BaseService {
     @Autowired
     BoosterStationInfoRepository boosterStationInfoRepository;
 
-    public BoosterStationInfo findById() {
-        return boosterStationInfoRepository.findById();
+    private final String cacheKey = BoosterStationInfo.class.getSimpleName();
+
+    public BoosterStationInfo findById(String id) throws Exception {
+        List<BoosterStationInfo> list = findAll();
+        Optional<BoosterStationInfo> optional = list.stream().filter(t -> ObjectUtil.equal(t.getId(), id)).findFirst();
+        return optional.orElse(null);
     }
 
-    public List<BoosterStationInfo> findAll() {
-        return boosterStationInfoRepository.findAll();
+    public List<BoosterStationInfo> findAll() throws Exception {
+        return boosterStationInfoRepository.findAll(cacheKey);
     }
 
+    public List<BoosterStationInfo> fresh() throws Exception {
+        return boosterStationInfoRepository.fresh(cacheKey);
+    }
 
 }

+ 11 - 8
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/ElectricFieldService.java

@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
 @Slf4j
@@ -16,17 +17,19 @@ public class ElectricFieldService extends BaseService {
     @Autowired
     ElectricFieldRepository electricFieldRepository;
 
-    public ElectricField findFirst() {
-        return electricFieldRepository.findFirst();
-    }
+    private final String cacheKey = ElectricField.class.getSimpleName();
 
-    public ElectricField findById(String stationCode) {
-        return electricFieldRepository.findByStationCode(stationCode);
+    public ElectricField findFirst() throws Exception {
+        List<ElectricField> list = findAll();
+        Optional<ElectricField> optional = list.stream().findFirst();
+        return optional.orElse(null);
     }
 
-    public List<ElectricField> findAll() {
-        return electricFieldRepository.findAll();
+    public List<ElectricField> findAll() throws Exception {
+        return electricFieldRepository.findAll(cacheKey);
     }
 
-
+    public List<ElectricField> fresh() throws Exception {
+        return electricFieldRepository.fresh(cacheKey);
+    }
 }

+ 16 - 5
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/EquipmentAttributeService.java

@@ -1,28 +1,39 @@
 package com.jiayue.ipfcst.spare2.baseinfos.service;
 
+import cn.hutool.core.util.ObjectUtil;
+import com.jiayue.ipfcst.common.data.entity.EquipmentAttribute;
 import com.jiayue.ipfcst.common.data.entity.EquipmentAttribute;
 import com.jiayue.ipfcst.spare2.base4.BaseService;
 import com.jiayue.ipfcst.spare2.baseinfos.repository.EquipmentAttributeRepository;
+import com.jiayue.ipfcst.spare2.baseinfos.repository.EquipmentAttributeRepository;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
 @Slf4j
 public class EquipmentAttributeService extends BaseService {
 
     @Autowired
-    EquipmentAttributeRepository EquipmentAttributeRepository;
+    EquipmentAttributeRepository equipmentAttributeRepository;
 
-    public EquipmentAttribute findById() {
-        return EquipmentAttributeRepository.findById();
+    private final String cacheKey = EquipmentAttribute.class.getSimpleName();
+
+    public EquipmentAttribute findById(String id) throws Exception {
+        List<EquipmentAttribute> list = findAll();
+        Optional<EquipmentAttribute> optional = list.stream().filter(t -> ObjectUtil.equal(t.getId(), id)).findFirst();
+        return optional.orElse(null);
     }
 
-    public List<EquipmentAttribute> findAll() {
-        return EquipmentAttributeRepository.findAll();
+    public List<EquipmentAttribute> findAll() throws Exception {
+        return equipmentAttributeRepository.findAll(cacheKey);
     }
 
+    public List<EquipmentAttribute> fresh() throws Exception {
+        return equipmentAttributeRepository.fresh(cacheKey);
+    }
 
 }

+ 13 - 4
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/Gather104TcpTunnelInfoService.java

@@ -1,5 +1,6 @@
 package com.jiayue.ipfcst.spare2.baseinfos.service;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.jiayue.ipfcst.common.data.entity.gathertunnelinfo.Gather104TcpTunnelInfo;
 import com.jiayue.ipfcst.spare2.base4.BaseService;
 import com.jiayue.ipfcst.spare2.baseinfos.repository.Gather104TcpTunnelInfoRepository;
@@ -8,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
 @Slf4j
@@ -16,13 +18,20 @@ public class Gather104TcpTunnelInfoService extends BaseService {
     @Autowired
     Gather104TcpTunnelInfoRepository gather104TcpTunnelInfoRepository;
 
-    public Gather104TcpTunnelInfo findById() {
-        return gather104TcpTunnelInfoRepository.findById();
+    private final String cacheKey = Gather104TcpTunnelInfo.class.getSimpleName();
+
+    public Gather104TcpTunnelInfo findById(String id) throws Exception {
+        List<Gather104TcpTunnelInfo> list = findAll();
+        Optional<Gather104TcpTunnelInfo> optional = list.stream().filter(t -> ObjectUtil.equal(t.getId(), id)).findFirst();
+        return optional.orElse(null);
     }
 
-    public List<Gather104TcpTunnelInfo> findAll() {
-        return gather104TcpTunnelInfoRepository.findAll();
+    public List<Gather104TcpTunnelInfo> findAll() throws Exception {
+        return gather104TcpTunnelInfoRepository.findAll(cacheKey);
     }
 
+    public List<Gather104TcpTunnelInfo> fresh() throws Exception {
+        return gather104TcpTunnelInfoRepository.fresh(cacheKey);
+    }
 
 }

+ 78 - 0
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/ImageLoadeService.java

@@ -0,0 +1,78 @@
+package com.jiayue.ipfcst.spare2.baseinfos.service;
+
+import com.jiayue.ipfcst.common.data.entity.ElectricField;
+import com.jiayue.ipfcst.spare2.base4.BaseService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Slf4j
+@Service
+public class ImageLoadeService extends BaseService {
+
+    @Autowired
+    AGC_AVCInfoService agcAvcInfoService;
+    @Autowired
+    BoosterStationInfoService boosterStationInfoService;
+    @Autowired
+    ElectricFieldService electricFieldService;
+    @Autowired
+    EquipmentAttributeService equipmentAttributeService;
+    @Autowired
+    Gather104TcpTunnelInfoService gather104TcpTunnelInfoService;
+    @Autowired
+    InitJobClassService initJobClassService;
+    @Autowired
+    InverterInfoService inverterInfoService;
+    @Autowired
+    ProtocolGatherDataPointService protocolGatherDataPointService;
+    @Autowired
+    PvModuleModelService pvModuleModelService;
+    @Autowired
+    QuartzService quartzService;
+    @Autowired
+    UploadFileChannelService uploadFileChannelService;
+    @Autowired
+    UploadFileCodeService uploadFileCodeService;
+    @Autowired
+    UploadObjectService uploadObjectService;
+    @Autowired
+    WeatherStationInfoService weatherStationInfoService;
+    @Autowired
+    WindTowerInfoService windTowerInfoService;
+    @Autowired
+    WindTurbineInfoService windTurbineInfoService;
+
+    public void imageLoad() {
+        log.info("==> 开始加载镜像基础信息");
+        try {// 加载“必要”基础信息
+            ElectricField electricField = electricFieldService.findFirst();
+            equipmentAttributeService.fresh();
+            //agcAvcInfoService.fresh();
+            //boosterStationInfoService.fresh();
+            //gather104TcpTunnelInfoService.fresh();
+            //initJobClassService.fresh();
+            inverterInfoService.fresh();
+            protocolGatherDataPointService.fresh();
+            pvModuleModelService.fresh();
+            quartzService.fresh();
+            sysParameterService.fresh();
+            uploadFileChannelService.fresh();
+            uploadObjectService.fresh();
+            uploadFileCodeService.fresh();
+            switch (electricField.getElectricFieldTypeEnum()) {
+                case E1://光伏
+                    weatherStationInfoService.fresh();
+                    break;
+                case E2://风电
+                    windTowerInfoService.fresh();
+                    windTurbineInfoService.fresh();
+                    break;
+            }
+            log.info("加载完成");
+        } catch (Exception ex) {
+            log.error(ex.getLocalizedMessage());
+        }
+        log.info("==> 结束加载镜像基础信息");
+    }
+}

+ 14 - 4
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/InitJobClassService.java

@@ -1,5 +1,6 @@
 package com.jiayue.ipfcst.spare2.baseinfos.service;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.jiayue.ipfcst.common.data.entity.InitJobClass;
 import com.jiayue.ipfcst.spare2.base4.BaseService;
 import com.jiayue.ipfcst.spare2.baseinfos.repository.InitJobClassRepository;
@@ -8,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
 @Slf4j
@@ -16,12 +18,20 @@ public class InitJobClassService extends BaseService {
     @Autowired
     InitJobClassRepository initJobClassRepository;
 
-    public InitJobClass findById() {
-        return initJobClassRepository.findById();
+    private final String cacheKey = InitJobClass.class.getSimpleName();
+
+    public InitJobClass findById(String id) throws Exception {
+        List<InitJobClass> list = findAll();
+        Optional<InitJobClass> optional = list.stream().filter(t -> ObjectUtil.equal(t.getId(), id)).findFirst();
+        return optional.orElse(null);
+    }
+
+    public List<InitJobClass> findAll() throws Exception {
+        return initJobClassRepository.findAll(cacheKey);
     }
 
-    public List<InitJobClass> findAll() {
-        return initJobClassRepository.findAll();
+    public List<InitJobClass> fresh() throws Exception {
+        return initJobClassRepository.fresh(cacheKey);
     }
 
 }

+ 15 - 4
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/InverterInfoService.java

@@ -1,13 +1,17 @@
 package com.jiayue.ipfcst.spare2.baseinfos.service;
 
+import cn.hutool.core.util.ObjectUtil;
+import com.jiayue.ipfcst.common.data.entity.InverterInfo;
 import com.jiayue.ipfcst.common.data.entity.InverterInfo;
 import com.jiayue.ipfcst.spare2.base4.BaseService;
 import com.jiayue.ipfcst.spare2.baseinfos.repository.InverterInfoRepository;
+import com.jiayue.ipfcst.spare2.baseinfos.repository.InverterInfoRepository;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
 @Slf4j
@@ -16,13 +20,20 @@ public class InverterInfoService extends BaseService {
     @Autowired
     InverterInfoRepository inverterInfoRepository;
 
-    public InverterInfo findById() {
-        return inverterInfoRepository.findById();
+    private final String cacheKey = InverterInfo.class.getSimpleName();
+
+    public InverterInfo findById(String id) throws Exception {
+        List<InverterInfo> list = findAll();
+        Optional<InverterInfo> optional = list.stream().filter(t -> ObjectUtil.equal(t.getId(), id)).findFirst();
+        return optional.orElse(null);
     }
 
-    public List<InverterInfo> findAll() {
-        return inverterInfoRepository.findAll();
+    public List<InverterInfo> findAll() throws Exception {
+        return inverterInfoRepository.findAll(cacheKey);
     }
 
+    public List<InverterInfo> fresh() throws Exception {
+        return inverterInfoRepository.fresh(cacheKey);
+    }
 
 }

+ 15 - 4
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/ProtocolGatherDataPointService.java

@@ -1,13 +1,17 @@
 package com.jiayue.ipfcst.spare2.baseinfos.service;
 
+import cn.hutool.core.util.ObjectUtil;
+import com.jiayue.ipfcst.common.data.entity.ProtocolGatherDataPoint;
 import com.jiayue.ipfcst.common.data.entity.ProtocolGatherDataPoint;
 import com.jiayue.ipfcst.spare2.base4.BaseService;
 import com.jiayue.ipfcst.spare2.baseinfos.repository.ProtocolGatherDataPointRepository;
+import com.jiayue.ipfcst.spare2.baseinfos.repository.ProtocolGatherDataPointRepository;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
 @Slf4j
@@ -16,13 +20,20 @@ public class ProtocolGatherDataPointService extends BaseService {
     @Autowired
     ProtocolGatherDataPointRepository protocolGatherDataPointRepository;
 
-    public ProtocolGatherDataPoint findById() {
-        return protocolGatherDataPointRepository.findById();
+    private final String cacheKey = ProtocolGatherDataPoint.class.getSimpleName();
+
+    public ProtocolGatherDataPoint findById(String id) throws Exception {
+        List<ProtocolGatherDataPoint> list = findAll();
+        Optional<ProtocolGatherDataPoint> optional = list.stream().filter(t -> ObjectUtil.equal(t.getId(), id)).findFirst();
+        return optional.orElse(null);
     }
 
-    public List<ProtocolGatherDataPoint> findAll() {
-        return protocolGatherDataPointRepository.findAll();
+    public List<ProtocolGatherDataPoint> findAll() throws Exception {
+        return protocolGatherDataPointRepository.findAll(cacheKey);
     }
 
+    public List<ProtocolGatherDataPoint> fresh() throws Exception {
+        return protocolGatherDataPointRepository.fresh(cacheKey);
+    }
 
 }

+ 14 - 4
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/PvModuleModelService.java

@@ -1,5 +1,7 @@
 package com.jiayue.ipfcst.spare2.baseinfos.service;
 
+import cn.hutool.core.util.ObjectUtil;
+import com.jiayue.ipfcst.common.data.entity.PvModuleModel;
 import com.jiayue.ipfcst.common.data.entity.PvModuleModel;
 import com.jiayue.ipfcst.spare2.base4.BaseService;
 import com.jiayue.ipfcst.spare2.baseinfos.repository.PvModuleModelRepository;
@@ -8,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
 @Slf4j
@@ -16,13 +19,20 @@ public class PvModuleModelService extends BaseService {
     @Autowired
     PvModuleModelRepository pvModuleModelRepository;
 
-    public PvModuleModel findById() {
-        return pvModuleModelRepository.findById();
+    private final String cacheKey = PvModuleModel.class.getSimpleName();
+
+    public PvModuleModel findById(String id) throws Exception {
+        List<PvModuleModel> list = findAll();
+        Optional<PvModuleModel> optional = list.stream().filter(t -> ObjectUtil.equal(t.getId(), id)).findFirst();
+        return optional.orElse(null);
     }
 
-    public List<PvModuleModel> findAll() {
-        return pvModuleModelRepository.findAll();
+    public List<PvModuleModel> findAll() throws Exception {
+        return pvModuleModelRepository.findAll(cacheKey);
     }
 
+    public List<PvModuleModel> fresh() throws Exception {
+        return pvModuleModelRepository.fresh(cacheKey);
+    }
 
 }

+ 15 - 4
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/QuartzService.java

@@ -1,13 +1,17 @@
 package com.jiayue.ipfcst.spare2.baseinfos.service;
 
+import cn.hutool.core.util.ObjectUtil;
+import com.jiayue.ipfcst.common.data.entity.Quartz;
 import com.jiayue.ipfcst.common.data.entity.Quartz;
 import com.jiayue.ipfcst.spare2.base4.BaseService;
 import com.jiayue.ipfcst.spare2.baseinfos.repository.QuartzRepository;
+import com.jiayue.ipfcst.spare2.baseinfos.repository.QuartzRepository;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
 @Slf4j
@@ -16,13 +20,20 @@ public class QuartzService extends BaseService {
     @Autowired
     QuartzRepository quartzRepository;
 
-    public Quartz findById() {
-        return quartzRepository.findById();
+    private final String cacheKey = Quartz.class.getSimpleName();
+
+    public Quartz findById(String id) throws Exception {
+        List<Quartz> list = findAll();
+        Optional<Quartz> optional = list.stream().filter(t -> ObjectUtil.equal(t.getId(), id)).findFirst();
+        return optional.orElse(null);
     }
 
-    public List<Quartz> findAll() {
-        return quartzRepository.findAll();
+    public List<Quartz> findAll() throws Exception {
+        return quartzRepository.findAll(cacheKey);
     }
 
+    public List<Quartz> fresh() throws Exception {
+        return quartzRepository.fresh(cacheKey);
+    }
 
 }

+ 15 - 4
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/SysParameterService.java

@@ -1,13 +1,17 @@
 package com.jiayue.ipfcst.spare2.baseinfos.service;
 
+import cn.hutool.core.util.ObjectUtil;
+import com.jiayue.ipfcst.common.data.entity.SysParameter;
 import com.jiayue.ipfcst.common.data.entity.SysParameter;
 import com.jiayue.ipfcst.spare2.base4.BaseService;
 import com.jiayue.ipfcst.spare2.baseinfos.repository.SysParameterRepository;
+import com.jiayue.ipfcst.spare2.baseinfos.repository.SysParameterRepository;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
 @Slf4j
@@ -16,13 +20,20 @@ public class SysParameterService extends BaseService {
     @Autowired
     SysParameterRepository sysParameterRepository;
 
-    public SysParameter findById() {
-        return sysParameterRepository.findById();
+    private final String cacheKey = SysParameter.class.getSimpleName();
+
+    public SysParameter findById(String id) throws Exception {
+        List<SysParameter> list = findAll();
+        Optional<SysParameter> optional = list.stream().filter(t -> ObjectUtil.equal(t.getId(), id)).findFirst();
+        return optional.orElse(null);
     }
 
-    public List<SysParameter> findAll() {
-        return sysParameterRepository.findAll();
+    public List<SysParameter> findAll() throws Exception {
+        return sysParameterRepository.findAll(cacheKey);
     }
 
+    public List<SysParameter> fresh() throws Exception {
+        return sysParameterRepository.fresh(cacheKey);
+    }
 
 }

+ 15 - 4
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/UploadFileChannelService.java

@@ -1,13 +1,17 @@
 package com.jiayue.ipfcst.spare2.baseinfos.service;
 
+import cn.hutool.core.util.ObjectUtil;
+import com.jiayue.ipfcst.common.data.entity.UploadFileChannel;
 import com.jiayue.ipfcst.common.data.entity.UploadFileChannel;
 import com.jiayue.ipfcst.spare2.base4.BaseService;
 import com.jiayue.ipfcst.spare2.baseinfos.repository.UploadFileChannelRepository;
+import com.jiayue.ipfcst.spare2.baseinfos.repository.UploadFileChannelRepository;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
 @Slf4j
@@ -16,13 +20,20 @@ public class UploadFileChannelService extends BaseService {
     @Autowired
     UploadFileChannelRepository uploadFileChannelRepository;
 
-    public UploadFileChannel findById() {
-        return uploadFileChannelRepository.findById();
+    private final String cacheKey = UploadFileChannel.class.getSimpleName();
+
+    public UploadFileChannel findById(String id) throws Exception {
+        List<UploadFileChannel> list = findAll();
+        Optional<UploadFileChannel> optional = list.stream().filter(t -> ObjectUtil.equal(t.getId(), id)).findFirst();
+        return optional.orElse(null);
     }
 
-    public List<UploadFileChannel> findAll() {
-        return uploadFileChannelRepository.findAll();
+    public List<UploadFileChannel> findAll() throws Exception {
+        return uploadFileChannelRepository.findAll(cacheKey);
     }
 
+    public List<UploadFileChannel> fresh() throws Exception {
+        return uploadFileChannelRepository.fresh(cacheKey);
+    }
 
 }

+ 15 - 4
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/UploadFileCodeService.java

@@ -1,13 +1,17 @@
 package com.jiayue.ipfcst.spare2.baseinfos.service;
 
+import cn.hutool.core.util.ObjectUtil;
+import com.jiayue.ipfcst.common.data.entity.UploadFileCode;
 import com.jiayue.ipfcst.common.data.entity.UploadFileCode;
 import com.jiayue.ipfcst.spare2.base4.BaseService;
 import com.jiayue.ipfcst.spare2.baseinfos.repository.UploadFileCodeRepository;
+import com.jiayue.ipfcst.spare2.baseinfos.repository.UploadFileCodeRepository;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
 @Slf4j
@@ -16,13 +20,20 @@ public class UploadFileCodeService extends BaseService {
     @Autowired
     UploadFileCodeRepository uploadFileCodeRepository;
 
-    public UploadFileCode findById() {
-        return uploadFileCodeRepository.findById();
+    private final String cacheKey = UploadFileCode.class.getSimpleName();
+
+    public UploadFileCode findById(String id) throws Exception {
+        List<UploadFileCode> list = findAll();
+        Optional<UploadFileCode> optional = list.stream().filter(t -> ObjectUtil.equal(t.getId(), id)).findFirst();
+        return optional.orElse(null);
     }
 
-    public List<UploadFileCode> findAll() {
-        return uploadFileCodeRepository.findAll();
+    public List<UploadFileCode> findAll() throws Exception {
+        return uploadFileCodeRepository.findAll(cacheKey);
     }
 
+    public List<UploadFileCode> fresh() throws Exception {
+        return uploadFileCodeRepository.fresh(cacheKey);
+    }
 
 }

+ 0 - 28
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/UploadObiectService.java

@@ -1,28 +0,0 @@
-package com.jiayue.ipfcst.spare2.baseinfos.service;
-
-import com.jiayue.ipfcst.common.data.entity.UploadObject;
-import com.jiayue.ipfcst.spare2.base4.BaseService;
-import com.jiayue.ipfcst.spare2.baseinfos.repository.UploadObjectRepository;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-@Service
-@Slf4j
-public class UploadObiectService extends BaseService {
-
-    @Autowired
-    UploadObjectRepository uploadObjectRepository;
-
-    public UploadObject findById() {
-        return uploadObjectRepository.findById();
-    }
-
-    public List<UploadObject> findAll() {
-        return uploadObjectRepository.findAll();
-    }
-
-
-}

+ 39 - 0
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/UploadObjectService.java

@@ -0,0 +1,39 @@
+package com.jiayue.ipfcst.spare2.baseinfos.service;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.jiayue.ipfcst.common.data.entity.UploadObject;
+import com.jiayue.ipfcst.common.data.entity.UploadObject;
+import com.jiayue.ipfcst.spare2.base4.BaseService;
+import com.jiayue.ipfcst.spare2.baseinfos.repository.UploadObjectRepository;
+import com.jiayue.ipfcst.spare2.baseinfos.repository.UploadObjectRepository;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Optional;
+
+@Service
+@Slf4j
+public class UploadObjectService extends BaseService {
+
+    @Autowired
+    UploadObjectRepository uploadObjectRepository;
+
+    private final String cacheKey = UploadObject.class.getSimpleName();
+
+    public UploadObject findById(String id) throws Exception {
+        List<UploadObject> list = findAll();
+        Optional<UploadObject> optional = list.stream().filter(t -> ObjectUtil.equal(t.getId(), id)).findFirst();
+        return optional.orElse(null);
+    }
+
+    public List<UploadObject> findAll() throws Exception {
+        return uploadObjectRepository.findAll(cacheKey);
+    }
+
+    public List<UploadObject> fresh() throws Exception {
+        return uploadObjectRepository.fresh(cacheKey);
+    }
+
+}

+ 15 - 4
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/WeatherStationInfoService.java

@@ -1,13 +1,17 @@
 package com.jiayue.ipfcst.spare2.baseinfos.service;
 
+import cn.hutool.core.util.ObjectUtil;
+import com.jiayue.ipfcst.common.data.entity.WeatherStationInfo;
 import com.jiayue.ipfcst.common.data.entity.WeatherStationInfo;
 import com.jiayue.ipfcst.spare2.base4.BaseService;
 import com.jiayue.ipfcst.spare2.baseinfos.repository.WeatherStationInfoRepository;
+import com.jiayue.ipfcst.spare2.baseinfos.repository.WeatherStationInfoRepository;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
 @Slf4j
@@ -16,13 +20,20 @@ public class WeatherStationInfoService extends BaseService {
     @Autowired
     WeatherStationInfoRepository weatherStationInfoRepository;
 
-    public WeatherStationInfo findById() {
-        return weatherStationInfoRepository.findById();
+    private final String cacheKey = WeatherStationInfo.class.getSimpleName();
+
+    public WeatherStationInfo findById(String id) throws Exception {
+        List<WeatherStationInfo> list = findAll();
+        Optional<WeatherStationInfo> optional = list.stream().filter(t -> ObjectUtil.equal(t.getId(), id)).findFirst();
+        return optional.orElse(null);
     }
 
-    public List<WeatherStationInfo> findAll() {
-        return weatherStationInfoRepository.findAll();
+    public List<WeatherStationInfo> findAll() throws Exception {
+        return weatherStationInfoRepository.findAll(cacheKey);
     }
 
+    public List<WeatherStationInfo> fresh() throws Exception {
+        return weatherStationInfoRepository.fresh(cacheKey);
+    }
 
 }

+ 15 - 4
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/WindTowerInfoService.java

@@ -1,13 +1,17 @@
 package com.jiayue.ipfcst.spare2.baseinfos.service;
 
+import cn.hutool.core.util.ObjectUtil;
+import com.jiayue.ipfcst.common.data.entity.WindTowerInfo;
 import com.jiayue.ipfcst.common.data.entity.WindTowerInfo;
 import com.jiayue.ipfcst.spare2.base4.BaseService;
 import com.jiayue.ipfcst.spare2.baseinfos.repository.WindTowerInfoRepository;
+import com.jiayue.ipfcst.spare2.baseinfos.repository.WindTowerInfoRepository;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
 @Slf4j
@@ -16,13 +20,20 @@ public class WindTowerInfoService extends BaseService {
     @Autowired
     WindTowerInfoRepository windTowerInfoRepository;
 
-    public WindTowerInfo findById() {
-        return windTowerInfoRepository.findById();
+    private final String cacheKey = WindTowerInfo.class.getSimpleName();
+
+    public WindTowerInfo findById(String id) throws Exception {
+        List<WindTowerInfo> list = findAll();
+        Optional<WindTowerInfo> optional = list.stream().filter(t -> ObjectUtil.equal(t.getId(), id)).findFirst();
+        return optional.orElse(null);
     }
 
-    public List<WindTowerInfo> findAll() {
-        return windTowerInfoRepository.findAll();
+    public List<WindTowerInfo> findAll() throws Exception {
+        return windTowerInfoRepository.findAll(cacheKey);
     }
 
+    public List<WindTowerInfo> fresh() throws Exception {
+        return windTowerInfoRepository.fresh(cacheKey);
+    }
 
 }

+ 15 - 4
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/baseinfos/service/WindTurbineInfoService.java

@@ -1,13 +1,17 @@
 package com.jiayue.ipfcst.spare2.baseinfos.service;
 
+import cn.hutool.core.util.ObjectUtil;
+import com.jiayue.ipfcst.common.data.entity.WindTurbineInfo;
 import com.jiayue.ipfcst.common.data.entity.WindTurbineInfo;
 import com.jiayue.ipfcst.spare2.base4.BaseService;
 import com.jiayue.ipfcst.spare2.baseinfos.repository.WindTurbineInfoRepository;
+import com.jiayue.ipfcst.spare2.baseinfos.repository.WindTurbineInfoRepository;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
 @Slf4j
@@ -16,13 +20,20 @@ public class WindTurbineInfoService extends BaseService {
     @Autowired
     WindTurbineInfoRepository windTurbineInfoRepository;
 
-    public WindTurbineInfo findById() {
-        return windTurbineInfoRepository.findById();
+    private final String cacheKey = WindTurbineInfo.class.getSimpleName();
+
+    public WindTurbineInfo findById(String id) throws Exception {
+        List<WindTurbineInfo> list = findAll();
+        Optional<WindTurbineInfo> optional = list.stream().filter(t -> ObjectUtil.equal(t.getId(), id)).findFirst();
+        return optional.orElse(null);
     }
 
-    public List<WindTurbineInfo> findAll() {
-        return windTurbineInfoRepository.findAll();
+    public List<WindTurbineInfo> findAll() throws Exception {
+        return windTurbineInfoRepository.findAll(cacheKey);
     }
 
+    public List<WindTurbineInfo> fresh() throws Exception {
+        return windTurbineInfoRepository.fresh(cacheKey);
+    }
 
 }

+ 8 - 1
ipfcst-spare2/src/main/java/com/jiayue/ipfcst/spare2/job/ConsoleCheckUpJob.java

@@ -9,8 +9,11 @@ import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import com.jiayue.ipfcst.common.data.dto.ProcessResult;
 import com.jiayue.ipfcst.common.data.util.ShellUtil;
+import com.jiayue.ipfcst.spare2.base4.BaseService;
+import com.jiayue.ipfcst.spare2.baseinfos.service.ImageLoadeService;
 import com.jiayue.ipfcst.spare2.util.FileUtil;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
@@ -24,7 +27,10 @@ import java.util.Map;
 @Slf4j
 @Service
 @EnableScheduling
-public class ConsoleCheckUpJob {
+public class ConsoleCheckUpJob extends BaseService {
+
+    @Autowired
+    ImageLoadeService imageLoadeService;
 
     @Scheduled(cron = "0/30 * * * * *")
     public void MonitConsoleUp() {
@@ -62,6 +68,7 @@ public class ConsoleCheckUpJob {
         //console进程不存在或者console健康接口返回为异常,启动spare2文件生成逻辑
         if (error) {
             log.info("spare2程序生成文件");
+            imageLoadeService.imageLoad();
         } else {
             log.info("console程序生成文件");
         }

+ 3 - 0
ipfcst-spare2/src/main/resources/application.yml

@@ -3,5 +3,8 @@ server:
 spring:
   main:
     web-application-type: none
+  cache:
+    type: ehcache
+
 logging:
   config: classpath:logback-spare2.xml

+ 7 - 0
ipfcst-spare2/src/main/resources/ehcache-setting.xml

@@ -35,4 +35,11 @@
            diskExpiryThreadIntervalSeconds="120"
     />
 
+    <cache name="spare2"
+           maxElementsInMemory="10000"
+           eternal="false"
+           overflowToDisk="true"
+           diskPersistent="false"
+           diskExpiryThreadIntervalSeconds="120"
+    />
 </ehcache>