Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
段飞宇 1 year ago
parent
commit
c51f8296de
  1. 76
      hzims-service/hzims-scheduled/pom.xml
  2. 26
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java
  3. 15
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/DeviceMapper.java
  4. 16
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/DeviceParamMapper.java
  5. 1
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java
  6. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java
  7. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java
  8. 14
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/DeviceParamService.java
  9. 15
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/DeviceService.java
  10. 28
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/DeviceParamServiceImpl.java
  11. 28
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/DeviceServiceImpl.java
  12. 3
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/PlanServiceImpl.java
  13. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/WorkshopInfoServiceImpl.java
  14. 7
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/DataService.java
  15. 3
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/RealTargetService.java
  16. 35
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/DataServiceImpl.java
  17. 3
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MonitorServiceImpl.java
  18. 139
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java
  19. 6
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ShowServiceImpl.java
  20. 19
      hzims-service/hzims-scheduled/src/main/resources/banner.txt
  21. 19
      hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/DeviceMapper.xml
  22. 15
      hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/DeviceParamMapper.xml
  23. 2
      hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/PlanMapper.xml
  24. 5
      hzims-service/inspect/pom.xml
  25. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/scheduled/StAlamRecordTask.java
  26. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java

76
hzims-service/hzims-scheduled/pom.xml

@ -12,9 +12,9 @@
<artifactId>hzims-scheduled</artifactId> <artifactId>hzims-scheduled</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<documents4j.version>1.0.3</documents4j.version>
<swagger-bootstrap-ui.version>1.9.6</swagger-bootstrap-ui.version>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
@ -25,24 +25,11 @@
<dependency> <dependency>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-core-boot</artifactId> <artifactId>blade-core-boot</artifactId>
<exclusions>
<exclusion>
<groupId>org.springblade</groupId>
<artifactId>blade-core-cloud</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-core-cloud</artifactId> <artifactId>blade-core-cloud</artifactId>
<exclusions>
<exclusion>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-common</artifactId> <artifactId>blade-common</artifactId>
@ -82,26 +69,48 @@
<artifactId>xxl-job-core</artifactId> <artifactId>xxl-job-core</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.15</version>
</dependency>
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jcommon</artifactId>
<version>1.0.24</version>
</dependency>
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>com.hikvision.ga</groupId>
<artifactId>artemis-http-client</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId> <groupId>com.hnac.hzims</groupId>
<artifactId>equipment-api</artifactId> <artifactId>equipment-api</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.hnac.hzims</groupId> <groupId>com.hnac.hzims</groupId>
<artifactId>message-api</artifactId> <artifactId>message-api</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.hnac.hzims</groupId> <groupId>com.hnac.hzims</groupId>
<artifactId>ticket-api</artifactId> <artifactId>ticket-api</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.hnac.hzims</groupId> <groupId>com.hnac.hzims</groupId>
<artifactId>assets-api</artifactId> <artifactId>assets-api</artifactId>
</dependency> </dependency>
<!-- -->
<dependency> <dependency>
<groupId>com.google.zxing</groupId> <groupId>com.google.zxing</groupId>
<artifactId>core</artifactId> <artifactId>core</artifactId>
@ -119,6 +128,16 @@
<artifactId>commons-collections4</artifactId> <artifactId>commons-collections4</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-http</artifactId> <artifactId>hutool-http</artifactId>
</dependency> </dependency>
@ -127,6 +146,10 @@
<artifactId>hutool-core</artifactId> <artifactId>hutool-core</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-resource-api</artifactId> <artifactId>blade-resource-api</artifactId>
</dependency> </dependency>
@ -154,7 +177,16 @@
<groupId>com.hnac.hzinfo.data</groupId> <groupId>com.hnac.hzinfo.data</groupId>
<artifactId>hzinfo-data-sdk</artifactId> <artifactId>hzinfo-data-sdk</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>${swagger-bootstrap-ui.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>2.5.6</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -178,4 +210,4 @@
</plugins> </plugins>
</build> </build>
</project> </project>

26
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java

@ -2,30 +2,30 @@ package com.hnac.hzims.scheduled;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springblade.core.cloud.feign.EnableBladeFeign; import org.springblade.core.cloud.feign.EnableBladeFeign;
import org.springframework.boot.Banner; import org.springblade.core.launch.BladeApplication;
import org.springframework.boot.SpringApplication; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.SpringCloudApplication; import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import javax.annotation.Resource; import javax.annotation.Resource;
/** /**
* @Author dfy * @author ysj
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 9:05
*/ */
@EnableBladeFeign @EnableBladeFeign
@SpringCloudApplication @SpringCloudApplication
@MapperScan("com.hnac.hzims.scheduled.**.mapper.**") @MapperScan("com.hnac.hzims.**.mapper.**")
@ComponentScan(basePackages = {"com.hnac.*","org.springblade.core"}) @ComponentScan(basePackages = {"com.hnac.*"})
@Resource @Resource
public class ScheduledApplication { public class ScheduledApplication extends SpringBootServletInitializer {
public static void main(String[] args) { public static void main(String[] args) {
// BladeApplication.run(ScheduledConstants.APP_NAME, ScheduledApplication.class, args); BladeApplication.run("hzims-scheduled", ScheduledApplication.class, args);
SpringApplication springApplication = new SpringApplication(ScheduledApplication.class);
springApplication.setBannerMode(Banner.Mode.OFF);
springApplication.run(args);
} }
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return BladeApplication.createSpringApplicationBuilder(builder, "hzims-scheduled", ScheduledApplication.class);
}
} }

15
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/DeviceMapper.java

@ -0,0 +1,15 @@
package com.hnac.hzims.scheduled.mapper.equipment;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.List;
/**
* @author ysj
*/
public interface DeviceMapper extends UserDataScopeBaseMapper<EmInfoEntity> {
List<EminfoAndEmParamVo> device();
}

16
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/DeviceParamMapper.java

@ -0,0 +1,16 @@
package com.hnac.hzims.scheduled.mapper.equipment;
import com.hnac.hzims.equipment.entity.EmParamEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.List;
/**
* Mapper 接口
*
* @author Chill
*/
public interface DeviceParamMapper extends UserDataScopeBaseMapper<EmParamEntity> {
List<EmParamEntity> params();
}

1
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java

@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Date; import java.util.Date;

13
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java

@ -8,11 +8,13 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import static com.hnac.hzims.fdp.constants.ScheduledConstant.LOAD_EM_INFO;
import static com.hnac.hzims.operational.main.constant.MainConstants.*; import static com.hnac.hzims.operational.main.constant.MainConstants.*;
@ -26,6 +28,17 @@ public class RealTargetScheduledTask {
@Autowired @Autowired
private RealTargetService service; private RealTargetService service;
/**
* 设备信息缓存
* @return
* @throws Exception
*/
@XxlJob(LOAD_EM_INFO)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadEmInfo(String param) {
service.loadEmInfo();
return new ReturnT<>("SUCCESS");
}
/** /**
* 水电站-机组实时加载 * 水电站-机组实时加载

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java

@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Date; import java.util.Date;
@ -28,6 +29,7 @@ public class ShowScheduledTask {
* 首页-指标数据加载 * 首页-指标数据加载
*/ */
@XxlJob(LOAD_HOME_TARGET) @XxlJob(LOAD_HOME_TARGET)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHomeTarget(String param) { public ReturnT<String> loadHomeTarget(String param) {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");

14
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/DeviceParamService.java

@ -0,0 +1,14 @@
package com.hnac.hzims.scheduled.service.equipment;
import com.hnac.hzims.equipment.entity.EmParamEntity;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
/**
* @author ysj
*/
public interface DeviceParamService extends BaseService<EmParamEntity> {
List<EmParamEntity> params();
}

15
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/DeviceService.java

@ -0,0 +1,15 @@
package com.hnac.hzims.scheduled.service.equipment;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
/**
* @author ysj
*/
public interface DeviceService extends BaseService<EmInfoEntity> {
List<EminfoAndEmParamVo> device();
}

28
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/DeviceParamServiceImpl.java

@ -0,0 +1,28 @@
package com.hnac.hzims.scheduled.service.equipment.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hnac.hzims.equipment.entity.EmParamEntity;
import com.hnac.hzims.scheduled.mapper.equipment.DeviceParamMapper;
import com.hnac.hzims.scheduled.service.equipment.DeviceParamService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author ysj
*/
@AllArgsConstructor
@Service
@Slf4j
@DS("equipment")
public class DeviceParamServiceImpl extends BaseServiceImpl<DeviceParamMapper, EmParamEntity> implements DeviceParamService {
@Override
public List<EmParamEntity> params() {
return this.baseMapper.params();
}
}

28
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/DeviceServiceImpl.java

@ -0,0 +1,28 @@
package com.hnac.hzims.scheduled.service.equipment.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.scheduled.mapper.equipment.DeviceMapper;
import com.hnac.hzims.scheduled.service.equipment.DeviceService;
import com.sun.org.apache.regexp.internal.RE;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author ysj
*/
@AllArgsConstructor
@Service
@Slf4j
@DS("equipment")
public class DeviceServiceImpl extends BaseServiceImpl<DeviceMapper, EmInfoEntity> implements DeviceService {
@Override
public List<EminfoAndEmParamVo> device() {
return this.baseMapper.device();
}
}

3
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/PlanServiceImpl.java

@ -14,13 +14,12 @@ import java.util.List;
/** /**
* @author ysj * @author ysj
*/ */
@AllArgsConstructor
@Service @Service
@Slf4j @Slf4j
@AllArgsConstructor
@DS("equipment") @DS("equipment")
public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanGenerationEntity> implements PlanService { public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanGenerationEntity> implements PlanService {
/** /**
* 查询计划发电量 * 查询计划发电量
* @param stationIds * @param stationIds

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/WorkshopInfoServiceImpl.java

@ -12,8 +12,8 @@ import org.springframework.stereotype.Service;
/** /**
* @author hx * @author hx
*/ */
@Service
@AllArgsConstructor @AllArgsConstructor
@Service
@Slf4j @Slf4j
@DS("equipment") @DS("equipment")
public class WorkshopInfoServiceImpl extends BaseServiceImpl<WorkshopInfoMapper, WorkshopInfoEntity> implements WorkshopInfoService { public class WorkshopInfoServiceImpl extends BaseServiceImpl<WorkshopInfoMapper, WorkshopInfoEntity> implements WorkshopInfoService {

7
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AnalyseDataService.java → hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/DataService.java

@ -1,8 +1,10 @@
package com.hnac.hzims.scheduled.service.operation; package com.hnac.hzims.scheduled.service.operation;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO; import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
import org.springblade.core.tool.api.R;
import java.util.List; import java.util.List;
import java.util.function.Function; import java.util.function.Function;
@ -11,10 +13,13 @@ import java.util.function.Function;
/** /**
* @author ysj * @author ysj
*/ */
public interface AnalyseDataService { public interface DataService {
<T> List<AnalyzeCodeBySignagesVO> getAnalyzeCodeBySignages(Function<T, MultiAnalyzeCodePO> convert, T resource); <T> List<AnalyzeCodeBySignagesVO> getAnalyzeCodeBySignages(Function<T, MultiAnalyzeCodePO> convert, T resource);
List<AnalyzeCodeBySignagesVO> analyzeCodeBySignages(List<MultiAnalyzeCodePO> list);
List<FieldsData> getRealDataByAnalyzeCode(String instanceCode, List<String> signages);
List<AnalyseDataTaosVO> periodTargetData(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signages); List<AnalyseDataTaosVO> periodTargetData(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signages);

3
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/RealTargetService.java

@ -8,6 +8,9 @@ import java.util.List;
*/ */
public interface RealTargetService { public interface RealTargetService {
void loadEmInfo();
// 水电站实时数据加载 // 水电站实时数据加载
void loadHydropowerReal(String param); void loadHydropowerReal(String param);

35
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AnalyseDataServiceImpl.java → hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/DataServiceImpl.java

@ -1,14 +1,17 @@
package com.hnac.hzims.scheduled.service.operation.impl; package com.hnac.hzims.scheduled.service.operation.impl;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.scheduled.service.operation.AnalyseDataService; import com.hnac.hzims.scheduled.service.operation.DataService;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO; import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyzeDataConditionPO; import com.hnac.hzinfo.datasearch.analyse.po.AnalyzeDataConditionPO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO;
import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO;
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO; import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
import com.sun.org.apache.regexp.internal.RE;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -20,10 +23,7 @@ import org.springframework.stereotype.Service;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -33,7 +33,7 @@ import java.util.stream.Collectors;
@Service @Service
@AllArgsConstructor @AllArgsConstructor
@Slf4j @Slf4j
public class AnalyseDataServiceImpl implements AnalyseDataService { public class DataServiceImpl implements DataService {
private final IAnalyseDataSearchClient analyseDataSearchClient; private final IAnalyseDataSearchClient analyseDataSearchClient;
@ -48,6 +48,29 @@ public class AnalyseDataServiceImpl implements AnalyseDataService {
return result; return result;
} }
@Override
public List<AnalyzeCodeBySignagesVO> analyzeCodeBySignages(List<MultiAnalyzeCodePO> list) {
R<List<AnalyzeCodeBySignagesVO>> result = analyseDataSearchClient.getAnalyzeCodeBySignages(list);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return new ArrayList<>();
}
return result.getData();
}
@Override
public List<FieldsData> getRealDataByAnalyzeCode(String instanceCode, List<String> signages) {
RealDataSearchPO realData = new RealDataSearchPO();
realData.setAnalyzeCode(instanceCode);
realData.setSignages(signages);
// 调用fegin接口查询实时数据
R<List<FieldsData>> result = analyseDataSearchClient.getRealDataByAnalyzeCode(realData);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return new ArrayList<>();
}
return result.getData();
}
/*** /***
* 指标数据列表查询 * 指标数据列表查询
* @param startTime 开始时间 * @param startTime 开始时间

3
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MonitorServiceImpl.java

@ -737,6 +737,9 @@ public class MonitorServiceImpl implements MonitorService {
// 遍历设备 // 遍历设备
List<String> result = new ArrayList<>(); List<String> result = new ArrayList<>();
for(EminfoAndEmParamVo device : filters){ for(EminfoAndEmParamVo device : filters){
if(CollectionUtil.isEmpty(device.getPoint())){
continue;
}
result.addAll(device.getPoint().values()); result.addAll(device.getPoint().values());
} }
return result; return result;

139
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java

@ -5,15 +5,17 @@ import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.EquipmentConstants; import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.equipment.entity.EmParamEntity;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.vo.*; import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.station.StationConstants; import com.hnac.hzims.operational.station.StationConstants;
import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity; import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.service.equipment.DeviceParamService;
import com.hnac.hzims.scheduled.service.equipment.DeviceService;
import com.hnac.hzims.scheduled.service.operation.*; import com.hnac.hzims.scheduled.service.operation.*;
import com.hnac.hzinfo.datasearch.PointData; import com.hnac.hzinfo.datasearch.PointData;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO; import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
@ -28,7 +30,6 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
@ -40,6 +41,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* APP首页实现类 * APP首页实现类
@ -52,13 +54,17 @@ public class RealTargetServiceImpl implements RealTargetService {
private final UseService useService; private final UseService useService;
private final DataService dataService;
private final PowerService powerService; private final PowerService powerService;
private final DeviceService deviceService;
private final StationService stationService; private final StationService stationService;
private final GenerateService generateService; private final GenerateService generateService;
private final AnalyseDataService analyseDataService; private final DeviceParamService deviceParamService;
private final StationAttributeService attributeService; private final StationAttributeService attributeService;
@ -66,8 +72,6 @@ public class RealTargetServiceImpl implements RealTargetService {
private final RedisTemplate redisTemplate; private final RedisTemplate redisTemplate;
private final IAnalyseDataSearchClient analyseDataSearchClient;
private final IHistoryDataSearchClient historyDataSearchClient; private final IHistoryDataSearchClient historyDataSearchClient;
@Value("${hzims.equipment.emInfo.emInfoList}") @Value("${hzims.equipment.emInfo.emInfoList}")
@ -86,6 +90,71 @@ public class RealTargetServiceImpl implements RealTargetService {
private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key"; private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key";
@Override
public void loadEmInfo() {
// 查询所有首页展示/状态非删除设备
List<EminfoAndEmParamVo> devices = deviceService.device();
// 查询所有设备(ct、pt、installedCapacity)配置参数
List<EmParamEntity> paramList = deviceParamService.params();
// 获取设备监测点位:未配置监测点位不进行统计设备
List<MultiAnalyzeCodePO> multiAnalyzeCodePOList = devices.stream().map(o->{
MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO();
multiAnalyzeCodePO.setDeviceCode(o.getEmCode());
multiAnalyzeCodePO.setSignages(HomePageConstant.SIGNAGES);
return multiAnalyzeCodePO;
}).collect(Collectors.toList());
// 切割
int limit = countStep(multiAnalyzeCodePOList.size());
List<List<MultiAnalyzeCodePO>> lists = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> multiAnalyzeCodePOList.stream().skip((long) a * 3).limit(3).parallel().collect(Collectors.toList())).collect(Collectors.toList());
// 接收数据
List<AnalyzeCodeBySignagesVO> analys = new ArrayList<>();
lists.forEach(list->{
List<AnalyzeCodeBySignagesVO> result = dataService.analyzeCodeBySignages(list);
if(CollectionUtil.isEmpty(result)){
return;
}
analys.addAll(result);
});
// 设备遍历
devices.forEach(item->{
item.setRideCount(1);
item.setInstalledCapacity(0.0);
List<AnalyzeCodeBySignagesVO> signages = analys.stream().filter(o-> item.getEmCode().equals(o.getDeviceCode()) && !StringUtil.isEmpty(o.getSignage()) && !StringUtil.isEmpty(o.getRealId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(signages)){
// list -> map
item.setPoint(signages.stream().collect(Collectors.toMap(AnalyzeCodeBySignagesVO::getSignage,AnalyzeCodeBySignagesVO::getRealId)));
}
// 寻找设备配置参数
List<EmParamEntity> itemParamList = paramList.stream().filter(o->item.getId().equals(o.getInfoId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(itemParamList)){
// 遍历设备配置参数
for(EmParamEntity param : itemParamList){
String param_name = param.getParamName();
switch (param_name){
case "ct":
item.setCt(Integer.valueOf(param.getParamValue()));
break;
case "pt":
item.setPt(Integer.valueOf(param.getParamValue()));
break;
case "installedCapacity":
item.setInstalledCapacity(Double.valueOf(param.getParamValue()));
break;
default:
break;
}
}
// 设置ct * pt
if(null != item.getCt() && null != item.getPt()){
item.setRideCount(item.getCt() * item.getPt());
}
}
});
// 设置缓存
redisTemplate.opsForValue().set(device_cache_cofig_final, JSONObject.toJSONString(devices.stream().filter(o-> Math.abs(o.getInstalledCapacity()) > 0 || MapUtils.isNotEmpty(o.getPoint())).collect(Collectors.toList())));
}
/** /**
* 加载水电站机组实时数据 * 加载水电站机组实时数据
* @param param * @param param
@ -297,15 +366,6 @@ public class RealTargetServiceImpl implements RealTargetService {
} }
List<WaterLevelVo> list = new ArrayList<>(); List<WaterLevelVo> list = new ArrayList<>();
modelList.forEach(item -> { modelList.forEach(item -> {
List<MultiAnalyzeCodePO> multiAnalyzeCodePOList = new ArrayList<>();
MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO();
multiAnalyzeCodePO.setDeviceCode(item.getInstanceCode());
multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL));
multiAnalyzeCodePOList.add(multiAnalyzeCodePO);
R<List<AnalyzeCodeBySignagesVO>> result = analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return;
}
WaterLevelVo waterLevelVo = new WaterLevelVo(); WaterLevelVo waterLevelVo = new WaterLevelVo();
waterLevelVo.setStationCode(item.getStationId()); waterLevelVo.setStationCode(item.getStationId());
// 前水位 // 前水位
@ -540,7 +600,7 @@ public class RealTargetServiceImpl implements RealTargetService {
private float getUsrPowerDay(EminfoAndEmParamVo device) { private float getUsrPowerDay(EminfoAndEmParamVo device) {
String time = DateUtil.format(new Date(),DateUtil.PATTERN_DATE); String time = DateUtil.format(new Date(),DateUtil.PATTERN_DATE);
// 当日用电量 // 当日用电量
return analyseDataService.periodTargetFloat(time + " 00:00:00",time + " 23:59:59",5,3,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION); return dataService.periodTargetFloat(time + " 00:00:00",time + " 23:59:59",5,3,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION);
} }
@ -553,7 +613,7 @@ public class RealTargetServiceImpl implements RealTargetService {
String start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00"; String start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00";
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
// 当月用电量 // 当月用电量
return analyseDataService.periodTargetFloat(start,end,5,5,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION); return dataService.periodTargetFloat(start,end,5,5,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION);
} }
/** /**
@ -569,7 +629,7 @@ public class RealTargetServiceImpl implements RealTargetService {
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1);
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
// 当年用电量 // 当年用电量
return analyseDataService.periodTargetFloat(start,end,5,6,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION); return dataService.periodTargetFloat(start,end,5,6,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION);
} }
/** /**
@ -580,7 +640,7 @@ public class RealTargetServiceImpl implements RealTargetService {
public List<ActivePowerVo> getActivePowerVoList(EminfoAndEmParamVo device) { public List<ActivePowerVo> getActivePowerVoList(EminfoAndEmParamVo device) {
String startTime = DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"); String startTime = DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00");
String endTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"); String endTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
List<AnalyseDataTaosVO> datas = analyseDataService.periodTargetData(startTime,endTime,2,6,device.getEmCode(),HomePageConstant.ACTIVE_POWER); List<AnalyseDataTaosVO> datas = dataService.periodTargetData(startTime,endTime,2,6,device.getEmCode(),HomePageConstant.ACTIVE_POWER);
if(CollectionUtil.isEmpty(datas)){ if(CollectionUtil.isEmpty(datas)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -607,7 +667,7 @@ public class RealTargetServiceImpl implements RealTargetService {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH,-29); calendar.add(Calendar.DAY_OF_MONTH,-29);
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION); List<AnalyseDataTaosVO> records = dataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION);
if(CollectionUtil.isEmpty(records)){ if(CollectionUtil.isEmpty(records)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -637,7 +697,7 @@ public class RealTargetServiceImpl implements RealTargetService {
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00"; String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00";
// 查询数据 // 查询数据
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION); List<AnalyseDataTaosVO> records = dataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION);
if(CollectionUtil.isEmpty(records)){ if(CollectionUtil.isEmpty(records)){
return new HashMap<>(); return new HashMap<>();
} }
@ -843,12 +903,12 @@ public class RealTargetServiceImpl implements RealTargetService {
List<String> signages = Collections.singletonList(signage); List<String> signages = Collections.singletonList(signage);
realData.setSignages(signages); realData.setSignages(signages);
// 调用fegin接口查询实时数据 // 调用fegin接口查询实时数据
R<List<FieldsData>> R = analyseDataSearchClient.getRealDataByAnalyzeCode(realData); List<FieldsData> fields = dataService.getRealDataByAnalyzeCode(instanceCode,signages);
if(!R.isSuccess() || CollectionUtil.isEmpty(R.getData())){ if(CollectionUtil.isEmpty(fields)){
return 0.0; return 0.0;
} }
// 时间限制 // 时间限制
String time = R.getData().get(0).getTime(); String time = fields.get(0).getTime();
if(StringUtil.isEmpty(time) || "-".equals(time)){ if(StringUtil.isEmpty(time) || "-".equals(time)){
return 0.0; return 0.0;
} }
@ -856,7 +916,7 @@ public class RealTargetServiceImpl implements RealTargetService {
if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){ if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){
return 0.0; return 0.0;
} }
return Double.parseDouble(R.getData().get(0).getValue()); return Double.parseDouble(fields.get(0).getValue());
} }
/** /**
@ -867,9 +927,9 @@ public class RealTargetServiceImpl implements RealTargetService {
*/ */
private Map<Integer, String> getWaterLevelMap(String instanceCode, String signage) { private Map<Integer, String> getWaterLevelMap(String instanceCode, String signage) {
String beginTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; String beginTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00";
String endTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATE); String endTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyseDataTaosVO> datas = analyseDataService.periodTargetData(beginTime, endTime,2, 6,instanceCode,signage); List<AnalyseDataTaosVO> datas = dataService.periodTargetData(beginTime, endTime,2, 6,instanceCode,signage);
if(CollectionUtil.isEmpty(datas)){ if(CollectionUtil.isEmpty(datas)){
return new HashMap<>(); return new HashMap<>();
} }
@ -1027,7 +1087,7 @@ public class RealTargetServiceImpl implements RealTargetService {
private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) { private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) {
String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00";
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD); List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
if (CollectionUtil.isEmpty(records)) { if (CollectionUtil.isEmpty(records)) {
return new ArrayList<>(); return new ArrayList<>();
} }
@ -1052,7 +1112,7 @@ public class RealTargetServiceImpl implements RealTargetService {
// 设备采集发电量 // 设备采集发电量
if(CollectionUtil.isNotEmpty(devices)){ if(CollectionUtil.isNotEmpty(devices)){
devices.forEach(device->{ devices.forEach(device->{
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); List<AnalyseDataTaosVO> records = dataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
if(CollectionUtil.isEmpty(records)){ if(CollectionUtil.isEmpty(records)){
return; return;
} }
@ -1260,7 +1320,7 @@ public class RealTargetServiceImpl implements RealTargetService {
default: default:
throw new ServiceException("无效查询类型!"); throw new ServiceException("无效查询类型!");
} }
return analyseDataService.periodTargetFloat(start, end, 5, cycleType, deviceCode, rideCount, HomePageConstant.PV_GENERATION_CAPACITY); return dataService.periodTargetFloat(start, end, 5, cycleType, deviceCode, rideCount, HomePageConstant.PV_GENERATION_CAPACITY);
} }
/** /**
@ -1272,7 +1332,7 @@ public class RealTargetServiceImpl implements RealTargetService {
private List<PhotovoltaicPowerVo> photovoltaicLoadsByDay(EminfoAndEmParamVo device) { private List<PhotovoltaicPowerVo> photovoltaicLoadsByDay(EminfoAndEmParamVo device) {
String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00";
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD); List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
if (CollectionUtil.isEmpty(records)) { if (CollectionUtil.isEmpty(records)) {
return new ArrayList<>(); return new ArrayList<>();
} }
@ -1299,7 +1359,7 @@ public class RealTargetServiceImpl implements RealTargetService {
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND));
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME);
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 5, 3, device.getEmCode(), HomePageConstant.PV_GENERATION_CAPACITY); List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 5, 3, device.getEmCode(), HomePageConstant.PV_GENERATION_CAPACITY);
if (CollectionUtil.isEmpty(records)) { if (CollectionUtil.isEmpty(records)) {
return new ArrayList<>(); return new ArrayList<>();
} }
@ -1350,6 +1410,13 @@ public class RealTargetServiceImpl implements RealTargetService {
} }
/** /**
* 计算切分次数
*/
private static Integer countStep(Integer size) {
return (size + 3 - 1) / 3;
}
/**
* 泵站设备 * 泵站设备
* @param stations * @param stations
* @return * @return
@ -1358,11 +1425,7 @@ public class RealTargetServiceImpl implements RealTargetService {
if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(stations)){
return new ArrayList<>(); return new ArrayList<>();
} }
List<EminfoAndEmParamVo> devices = null; List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(),new TypeReference<List<EminfoAndEmParamVo>>() {});
Object json = redisTemplate.opsForValue().get(device_cache_cofig_final);
if (ObjectUtil.isNotEmpty(json)) {
devices = JSONObject.parseObject(json.toString(),new TypeReference<List<EminfoAndEmParamVo>>() {});
}
if(CollectionUtil.isEmpty(devices)){ if(CollectionUtil.isEmpty(devices)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -1484,7 +1547,7 @@ public class RealTargetServiceImpl implements RealTargetService {
default: default:
throw new IllegalStateException("Unexpected value: " + scope); throw new IllegalStateException("Unexpected value: " + scope);
} }
return analyseDataService.periodTargetFloat(start,end,5,accessRules,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER); return dataService.periodTargetFloat(start,end,5,accessRules,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
} }
/** /**
@ -1495,7 +1558,7 @@ public class RealTargetServiceImpl implements RealTargetService {
private List<GenerationPowerVo> getGenerationPowerList(EminfoAndEmParamVo device) { private List<GenerationPowerVo> getGenerationPowerList(EminfoAndEmParamVo device) {
String start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00"; String start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00";
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); List<AnalyseDataTaosVO> records = dataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
if(CollectionUtil.isEmpty(records)){ if(CollectionUtil.isEmpty(records)){
return new ArrayList<>(); return new ArrayList<>();
} }

6
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ShowServiceImpl.java

@ -81,7 +81,7 @@ public class ShowServiceImpl implements ShowService {
private final OverDetailsService detailsService; private final OverDetailsService detailsService;
private final WorkTicketService workTicketService; private final WorkTicketService workTicketService;
private final PhenomenonService phenomenonService; private final PhenomenonService phenomenonService;
private final AnalyseDataService analyseDataService; private final DataService dataService;
private final MaintenanceService maintenanceService; private final MaintenanceService maintenanceService;
private final RedisTemplate redisTemplate; private final RedisTemplate redisTemplate;
private final ISysClient sysClient; private final ISysClient sysClient;
@ -100,7 +100,7 @@ public class ShowServiceImpl implements ShowService {
@Value("${hzims.equipment.emInfo.emInfoList}") @Value("${hzims.equipment.emInfo.emInfoList}")
public String device_cache_cofig_final; public String device_cache_cofig_final;
@Value("${hzims.operation.region.areaDutyInfoKey}") @Value("${hzims.operation.region.areaDutyInfoKey}")
private String area_duty_cache_final; private String area_duty_cache_final;
@Value("${hzims.operation.region.deviceClassifyKey}") @Value("${hzims.operation.region.deviceClassifyKey}")
@ -1138,7 +1138,7 @@ public class ShowServiceImpl implements ShowService {
return generate; return generate;
} }
for(EminfoAndEmParamVo device : devices ){ for(EminfoAndEmParamVo device : devices ){
generate += analyseDataService.periodTargetFloat(DateUtil.format(start,DateUtil.PATTERN_DATETIME),DateUtil.format(end,DateUtil.PATTERN_DATETIME),5,3,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER); generate += dataService.periodTargetFloat(DateUtil.format(start,DateUtil.PATTERN_DATETIME),DateUtil.format(end,DateUtil.PATTERN_DATETIME),5,3,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
} }
return generate; return generate;
} }

19
hzims-service/hzims-scheduled/src/main/resources/banner.txt

@ -0,0 +1,19 @@
.::::.
.::::::::.
:::::::::::
':::::::::::..
:::::::::::::::'
':::::::::::.
.::::::::::::::'
.:::::::::::...
::::::::::::::''
.:::. '::::::::''::::
.::::::::. ':::::' '::::
.::::':::::::. ::::: '::::.
.:::::' ':::::::::. ::::: ':::.
.:::::' ':::::::::.::::: '::.
.::::'' ':::::::::::::: '::.
.::'' ':::::::::::: :::...
..:::: ':::::::::' .:' ''''
..''''':' ':::::.'

19
hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/DeviceMapper.xml

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.scheduled.mapper.equipment.DeviceMapper">
<select id="device" resultType="com.hnac.hzims.equipment.vo.EminfoAndEmParamVo">
SELECT
ID AS id,
`NAME` AS NAME,
`NUMBER` AS emCode,
CREATE_DEPT AS createDept,
RUN_STATUS AS runStatus,
EM_INDEX AS ord
FROM
`hzims_em_info`
WHERE
IS_DELETED = 0
AND HOME_PAGE_DISPLAY = 1
</select>
</mapper>

15
hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/DeviceParamMapper.xml

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.scheduled.mapper.equipment.DeviceParamMapper">
<select id="params" resultType="com.hnac.hzims.equipment.entity.EmParamEntity">
SELECT *
FROM hzims_em_param
WHERE `IS_DELETED` = 0
AND (
PARAM_NAME = 'ct'
OR PARAM_NAME = 'pt'
OR PARAM_NAME = 'installedCapacity'
)
</select>
</mapper>

2
hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/PlanMapper.xml

@ -16,7 +16,7 @@
<result column="CREATE_DEPT" property="createDept" jdbcType="BIGINT"/> <result column="CREATE_DEPT" property="createDept" jdbcType="BIGINT"/>
</resultMap> </resultMap>
<select id="selectPlanGenerationByParam" resultType="com.hnac.hzims.equipment.entity.PlanGenerationEntity"> <select id="planGeneration" resultType="com.hnac.hzims.equipment.entity.PlanGenerationEntity">
select * from hz_ims_plan_generation select * from hz_ims_plan_generation
where IS_DELETED = 0 where IS_DELETED = 0
<if test="stationIds != null"> <if test="stationIds != null">

5
hzims-service/inspect/pom.xml

@ -137,11 +137,6 @@
<version>6.0.7</version> <version>6.0.7</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-oss-minio</artifactId>
<version>2.7.3.RELEASE</version>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId> <groupId>com.hnac.hzims</groupId>
<artifactId>message-api</artifactId> <artifactId>message-api</artifactId>
<version>${hzims.project.version}</version> <version>${hzims.project.version}</version>

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/scheduled/StAlamRecordTask.java

@ -53,10 +53,9 @@ public class StAlamRecordTask {
* realId获取 * realId获取
* @return ReturnT<String> * @return ReturnT<String>
*/ */
//@XxlJob(REAL_ID_DATA) @XxlJob(REAL_ID_DATA)
@Scheduled(cron = "0/40 * * * * ? ") //@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> realIdData() throws Exception { public ReturnT<String> realIdData(String param) throws Exception {
String param = "";
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
} }
@ -68,10 +67,9 @@ public class StAlamRecordTask {
* 站点实时数据 * 站点实时数据
* @return ReturnT<String> * @return ReturnT<String>
*/ */
//@XxlJob(REAL_TIME_DATA) @XxlJob(REAL_TIME_DATA)
@Scheduled(cron = "0/40 * * * * ? ") //@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> realTimeData() throws Exception { public ReturnT<String> realTimeData(String param) throws Exception {
String param = "";
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
} }

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java

@ -280,9 +280,10 @@ public class ScheduledCreateTask {
* 水电站-机组实时加载 * 水电站-机组实时加载
* @return ReturnT<String> * @return ReturnT<String>
*/ */
@XxlJob(LOAD_HYDROPOWER_UNIT_REAL) //@XxlJob(LOAD_HYDROPOWER_UNIT_REAL)
//@Scheduled(cron = "0/40 * * * * ? ") @Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHydropowerUnitReal(String param) throws Exception { public ReturnT<String> loadHydropowerUnitReal() throws Exception {
String param = "";
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
} }

Loading…
Cancel
Save