diff --git a/hzims-service/hzims-scheduled/pom.xml b/hzims-service/hzims-scheduled/pom.xml
index 87e3691..a904ab8 100644
--- a/hzims-service/hzims-scheduled/pom.xml
+++ b/hzims-service/hzims-scheduled/pom.xml
@@ -12,9 +12,9 @@
hzims-scheduled
jar
- 8
- 8
UTF-8
+ 1.0.3
+ 1.9.6
@@ -25,24 +25,11 @@
org.springblade
blade-core-boot
-
-
- org.springblade
- blade-core-cloud
-
-
org.springblade
blade-core-cloud
-
-
- io.github.openfeign
- feign-okhttp
-
-
-
org.springblade
blade-common
@@ -82,26 +69,48 @@
xxl-job-core
+ org.apache.poi
+ poi-ooxml-schemas
+ 3.15
+
+
+ org.jfree
+ jcommon
+ 1.0.24
+
+
+ org.jfree
+ jfreechart
+ 1.5.0
+
+
+ com.hikvision.ga
+ artemis-http-client
+
+
+ org.apache.httpcomponents
+ httpclient
+
+
+ org.freemarker
+ freemarker
+
+
com.hnac.hzims
equipment-api
-
com.hnac.hzims
message-api
-
com.hnac.hzims
ticket-api
-
com.hnac.hzims
assets-api
-
-
com.google.zxing
core
@@ -119,6 +128,16 @@
commons-collections4
+ org.springframework.boot
+ spring-boot-starter-websocket
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+
+
+
+
cn.hutool
hutool-http
@@ -127,6 +146,10 @@
hutool-core
+ org.java-websocket
+ Java-WebSocket
+
+
org.springblade
blade-resource-api
@@ -154,7 +177,16 @@
com.hnac.hzinfo.data
hzinfo-data-sdk
-
+
+ com.github.xiaoymin
+ swagger-bootstrap-ui
+ ${swagger-bootstrap-ui.version}
+
+
+ com.baomidou
+ dynamic-datasource-spring-boot-starter
+ 2.5.6
+
@@ -178,4 +210,4 @@
-
+
\ No newline at end of file
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java
index 63fb110..6b524df 100644
--- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java
+++ b/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.springblade.core.cloud.feign.EnableBladeFeign;
-import org.springframework.boot.Banner;
-import org.springframework.boot.SpringApplication;
+import org.springblade.core.launch.BladeApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.context.annotation.ComponentScan;
import javax.annotation.Resource;
+
/**
- * @Author dfy
- * @Version v1.0
- * @Serial 1.0
- * @Date 2023/5/19 9:05
+ * @author ysj
*/
@EnableBladeFeign
@SpringCloudApplication
-@MapperScan("com.hnac.hzims.scheduled.**.mapper.**")
-@ComponentScan(basePackages = {"com.hnac.*","org.springblade.core"})
+@MapperScan("com.hnac.hzims.**.mapper.**")
+@ComponentScan(basePackages = {"com.hnac.*"})
@Resource
-public class ScheduledApplication {
+public class ScheduledApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
- // BladeApplication.run(ScheduledConstants.APP_NAME, ScheduledApplication.class, args);
- SpringApplication springApplication = new SpringApplication(ScheduledApplication.class);
- springApplication.setBannerMode(Banner.Mode.OFF);
- springApplication.run(args);
+ BladeApplication.run("hzims-scheduled", ScheduledApplication.class, args);
}
+ @Override
+ protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
+ return BladeApplication.createSpringApplicationBuilder(builder, "hzims-scheduled", ScheduledApplication.class);
+ }
}
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/DeviceMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/DeviceMapper.java
new file mode 100644
index 0000000..55ca3e2
--- /dev/null
+++ b/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 {
+
+ List device();
+}
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/DeviceParamMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/DeviceParamMapper.java
new file mode 100644
index 0000000..f5bb375
--- /dev/null
+++ b/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 {
+
+ List params();
+}
\ No newline at end of file
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java
index 6e5a0e9..ee4a1a1 100644
--- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java
+++ b/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.Func;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Date;
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java
index b589578..3834f1a 100644
--- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java
+++ b/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.Func;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.Date;
+import static com.hnac.hzims.fdp.constants.ScheduledConstant.LOAD_EM_INFO;
import static com.hnac.hzims.operational.main.constant.MainConstants.*;
@@ -26,6 +28,17 @@ public class RealTargetScheduledTask {
@Autowired
private RealTargetService service;
+ /**
+ * 设备信息缓存
+ * @return
+ * @throws Exception
+ */
+ @XxlJob(LOAD_EM_INFO)
+ //@Scheduled(cron = "0/40 * * * * ? ")
+ public ReturnT loadEmInfo(String param) {
+ service.loadEmInfo();
+ return new ReturnT<>("SUCCESS");
+ }
/**
* 水电站-机组实时加载
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java
index ee07df0..a65d1da 100644
--- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java
+++ b/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.Func;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Date;
@@ -28,6 +29,7 @@ public class ShowScheduledTask {
* 首页-指标数据加载
*/
@XxlJob(LOAD_HOME_TARGET)
+ //@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT loadHomeTarget(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/DeviceParamService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/DeviceParamService.java
new file mode 100644
index 0000000..bfd7201
--- /dev/null
+++ b/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 {
+
+ List params();
+}
\ No newline at end of file
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/DeviceService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/DeviceService.java
new file mode 100644
index 0000000..5b08d88
--- /dev/null
+++ b/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 {
+
+ List device();
+}
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/DeviceParamServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/DeviceParamServiceImpl.java
new file mode 100644
index 0000000..dbc8332
--- /dev/null
+++ b/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 implements DeviceParamService {
+
+
+ @Override
+ public List params() {
+ return this.baseMapper.params();
+ }
+}
\ No newline at end of file
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/DeviceServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/DeviceServiceImpl.java
new file mode 100644
index 0000000..a93fb52
--- /dev/null
+++ b/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 implements DeviceService {
+ @Override
+ public List device() {
+ return this.baseMapper.device();
+ }
+}
\ No newline at end of file
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/PlanServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/PlanServiceImpl.java
index 56cc7ca..78e1ebe 100644
--- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/PlanServiceImpl.java
+++ b/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
*/
+@AllArgsConstructor
@Service
@Slf4j
-@AllArgsConstructor
@DS("equipment")
public class PlanServiceImpl extends BaseServiceImpl implements PlanService {
-
/**
* 查询计划发电量
* @param stationIds
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/WorkshopInfoServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/WorkshopInfoServiceImpl.java
index a82c6dc..fc1d94b 100644
--- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/WorkshopInfoServiceImpl.java
+++ b/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
*/
-@Service
@AllArgsConstructor
+@Service
@Slf4j
@DS("equipment")
public class WorkshopInfoServiceImpl extends BaseServiceImpl implements WorkshopInfoService {
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AnalyseDataService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/DataService.java
similarity index 71%
rename from hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AnalyseDataService.java
rename to hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/DataService.java
index 7f2fb5c..166658f 100644
--- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AnalyseDataService.java
+++ b/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;
+import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
+import org.springblade.core.tool.api.R;
import java.util.List;
import java.util.function.Function;
@@ -11,10 +13,13 @@ import java.util.function.Function;
/**
* @author ysj
*/
-public interface AnalyseDataService {
+public interface DataService {
List getAnalyzeCodeBySignages(Function convert, T resource);
+ List analyzeCodeBySignages(List list);
+
+ List getRealDataByAnalyzeCode(String instanceCode, List signages);
List periodTargetData(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signages);
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/RealTargetService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/RealTargetService.java
index 43afd9e..042f5d2 100644
--- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/RealTargetService.java
+++ b/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 {
+
+ void loadEmInfo();
+
// 水电站实时数据加载
void loadHydropowerReal(String param);
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AnalyseDataServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/DataServiceImpl.java
similarity index 84%
rename from hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AnalyseDataServiceImpl.java
rename to hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/DataServiceImpl.java
index b469c8a..c9b3847 100644
--- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AnalyseDataServiceImpl.java
+++ b/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;
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.domain.FieldsData;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyzeDataConditionPO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
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.sun.org.apache.regexp.internal.RE;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
@@ -20,10 +23,7 @@ import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Optional;
+import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -33,7 +33,7 @@ import java.util.stream.Collectors;
@Service
@AllArgsConstructor
@Slf4j
-public class AnalyseDataServiceImpl implements AnalyseDataService {
+public class DataServiceImpl implements DataService {
private final IAnalyseDataSearchClient analyseDataSearchClient;
@@ -48,6 +48,29 @@ public class AnalyseDataServiceImpl implements AnalyseDataService {
return result;
}
+ @Override
+ public List analyzeCodeBySignages(List list) {
+ R> result = analyseDataSearchClient.getAnalyzeCodeBySignages(list);
+ if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
+ return new ArrayList<>();
+ }
+ return result.getData();
+ }
+
+ @Override
+ public List getRealDataByAnalyzeCode(String instanceCode, List signages) {
+ RealDataSearchPO realData = new RealDataSearchPO();
+ realData.setAnalyzeCode(instanceCode);
+ realData.setSignages(signages);
+ // 调用fegin接口查询实时数据
+ R> result = analyseDataSearchClient.getRealDataByAnalyzeCode(realData);
+ if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
+ return new ArrayList<>();
+ }
+ return result.getData();
+ }
+
+
/***
* 指标数据列表查询
* @param startTime 开始时间
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MonitorServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MonitorServiceImpl.java
index 06145f6..07df760 100644
--- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MonitorServiceImpl.java
+++ b/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 result = new ArrayList<>();
for(EminfoAndEmParamVo device : filters){
+ if(CollectionUtil.isEmpty(device.getPoint())){
+ continue;
+ }
result.addAll(device.getPoint().values());
}
return result;
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java
index 6e08365..55fb6d7 100644
--- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java
+++ b/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.toolkit.Wrappers;
import com.hnac.hzims.EquipmentConstants;
+import com.hnac.hzims.equipment.entity.EmParamEntity;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.station.StationConstants;
import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity;
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.hzinfo.datasearch.PointData;
-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.vo.AnalyseDataTaosVO;
@@ -28,7 +30,6 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
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.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
@@ -40,6 +41,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
/**
* APP首页实现类
@@ -52,13 +54,17 @@ public class RealTargetServiceImpl implements RealTargetService {
private final UseService useService;
+ private final DataService dataService;
+
private final PowerService powerService;
+ private final DeviceService deviceService;
+
private final StationService stationService;
private final GenerateService generateService;
- private final AnalyseDataService analyseDataService;
+ private final DeviceParamService deviceParamService;
private final StationAttributeService attributeService;
@@ -66,8 +72,6 @@ public class RealTargetServiceImpl implements RealTargetService {
private final RedisTemplate redisTemplate;
- private final IAnalyseDataSearchClient analyseDataSearchClient;
-
private final IHistoryDataSearchClient historyDataSearchClient;
@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";
+ @Override
+ public void loadEmInfo() {
+ // 查询所有首页展示/状态非删除设备
+ List devices = deviceService.device();
+ // 查询所有设备(ct、pt、installedCapacity)配置参数
+ List paramList = deviceParamService.params();
+ // 获取设备监测点位:未配置监测点位不进行统计设备
+ List 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> 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 analys = new ArrayList<>();
+ lists.forEach(list->{
+ List result = dataService.analyzeCodeBySignages(list);
+ if(CollectionUtil.isEmpty(result)){
+ return;
+ }
+ analys.addAll(result);
+ });
+ // 设备遍历
+ devices.forEach(item->{
+ item.setRideCount(1);
+ item.setInstalledCapacity(0.0);
+ List 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 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
@@ -297,15 +366,6 @@ public class RealTargetServiceImpl implements RealTargetService {
}
List list = new ArrayList<>();
modelList.forEach(item -> {
- List multiAnalyzeCodePOList = new ArrayList<>();
- MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO();
- multiAnalyzeCodePO.setDeviceCode(item.getInstanceCode());
- multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL));
- multiAnalyzeCodePOList.add(multiAnalyzeCodePO);
- R> result = analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList);
- if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
- return;
- }
WaterLevelVo waterLevelVo = new WaterLevelVo();
waterLevelVo.setStationCode(item.getStationId());
// 前水位
@@ -540,7 +600,7 @@ public class RealTargetServiceImpl implements RealTargetService {
private float getUsrPowerDay(EminfoAndEmParamVo device) {
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 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);
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 getActivePowerVoList(EminfoAndEmParamVo device) {
String startTime = DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00");
String endTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
- List datas = analyseDataService.periodTargetData(startTime,endTime,2,6,device.getEmCode(),HomePageConstant.ACTIVE_POWER);
+ List datas = dataService.periodTargetData(startTime,endTime,2,6,device.getEmCode(),HomePageConstant.ACTIVE_POWER);
if(CollectionUtil.isEmpty(datas)){
return new ArrayList<>();
}
@@ -607,7 +667,7 @@ public class RealTargetServiceImpl implements RealTargetService {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH,-29);
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
- List records = analyseDataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION);
+ List records = dataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION);
if(CollectionUtil.isEmpty(records)){
return new ArrayList<>();
}
@@ -637,7 +697,7 @@ public class RealTargetServiceImpl implements RealTargetService {
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00";
// 查询数据
- List records = analyseDataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION);
+ List records = dataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION);
if(CollectionUtil.isEmpty(records)){
return new HashMap<>();
}
@@ -843,12 +903,12 @@ public class RealTargetServiceImpl implements RealTargetService {
List signages = Collections.singletonList(signage);
realData.setSignages(signages);
// 调用fegin接口查询实时数据
- R> R = analyseDataSearchClient.getRealDataByAnalyzeCode(realData);
- if(!R.isSuccess() || CollectionUtil.isEmpty(R.getData())){
+ List fields = dataService.getRealDataByAnalyzeCode(instanceCode,signages);
+ if(CollectionUtil.isEmpty(fields)){
return 0.0;
}
// 时间限制
- String time = R.getData().get(0).getTime();
+ String time = fields.get(0).getTime();
if(StringUtil.isEmpty(time) || "-".equals(time)){
return 0.0;
}
@@ -856,7 +916,7 @@ public class RealTargetServiceImpl implements RealTargetService {
if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){
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 getWaterLevelMap(String instanceCode, String signage) {
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();
- List datas = analyseDataService.periodTargetData(beginTime, endTime,2, 6,instanceCode,signage);
+ List datas = dataService.periodTargetData(beginTime, endTime,2, 6,instanceCode,signage);
if(CollectionUtil.isEmpty(datas)){
return new HashMap<>();
}
@@ -1027,7 +1087,7 @@ public class RealTargetServiceImpl implements RealTargetService {
private List getLoadsByDay(EminfoAndEmParamVo device) {
String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00";
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
- List records = analyseDataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
+ List records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
if (CollectionUtil.isEmpty(records)) {
return new ArrayList<>();
}
@@ -1052,7 +1112,7 @@ public class RealTargetServiceImpl implements RealTargetService {
// 设备采集发电量
if(CollectionUtil.isNotEmpty(devices)){
devices.forEach(device->{
- List records = analyseDataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
+ List records = dataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
if(CollectionUtil.isEmpty(records)){
return;
}
@@ -1260,7 +1320,7 @@ public class RealTargetServiceImpl implements RealTargetService {
default:
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 photovoltaicLoadsByDay(EminfoAndEmParamVo device) {
String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00";
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
- List records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
+ List records = dataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
if (CollectionUtil.isEmpty(records)) {
return new ArrayList<>();
}
@@ -1299,7 +1359,7 @@ public class RealTargetServiceImpl implements RealTargetService {
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND));
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME);
- List records = analyseDataService.periodTargetData(start, end, 5, 3, device.getEmCode(), HomePageConstant.PV_GENERATION_CAPACITY);
+ List records = dataService.periodTargetData(start, end, 5, 3, device.getEmCode(), HomePageConstant.PV_GENERATION_CAPACITY);
if (CollectionUtil.isEmpty(records)) {
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
* @return
@@ -1358,11 +1425,7 @@ public class RealTargetServiceImpl implements RealTargetService {
if(CollectionUtil.isEmpty(stations)){
return new ArrayList<>();
}
- List devices = null;
- Object json = redisTemplate.opsForValue().get(device_cache_cofig_final);
- if (ObjectUtil.isNotEmpty(json)) {
- devices = JSONObject.parseObject(json.toString(),new TypeReference>() {});
- }
+ List devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(),new TypeReference>() {});
if(CollectionUtil.isEmpty(devices)){
return new ArrayList<>();
}
@@ -1484,7 +1547,7 @@ public class RealTargetServiceImpl implements RealTargetService {
default:
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 getGenerationPowerList(EminfoAndEmParamVo device) {
String start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00";
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
- List records = analyseDataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
+ List records = dataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
if(CollectionUtil.isEmpty(records)){
return new ArrayList<>();
}
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ShowServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ShowServiceImpl.java
index 52a9617..9d2f707 100644
--- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ShowServiceImpl.java
+++ b/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 WorkTicketService workTicketService;
private final PhenomenonService phenomenonService;
- private final AnalyseDataService analyseDataService;
+ private final DataService dataService;
private final MaintenanceService maintenanceService;
private final RedisTemplate redisTemplate;
private final ISysClient sysClient;
@@ -100,7 +100,7 @@ public class ShowServiceImpl implements ShowService {
@Value("${hzims.equipment.emInfo.emInfoList}")
public String device_cache_cofig_final;
- @Value("${hzims.operation.region.areaDutyInfoKey}")
+ @Value("${hzims.operation.region.areaDutyInfoKey}")
private String area_duty_cache_final;
@Value("${hzims.operation.region.deviceClassifyKey}")
@@ -1138,7 +1138,7 @@ public class ShowServiceImpl implements ShowService {
return generate;
}
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;
}
diff --git a/hzims-service/hzims-scheduled/src/main/resources/banner.txt b/hzims-service/hzims-scheduled/src/main/resources/banner.txt
new file mode 100644
index 0000000..d85ea96
--- /dev/null
+++ b/hzims-service/hzims-scheduled/src/main/resources/banner.txt
@@ -0,0 +1,19 @@
+
+ .::::.
+ .::::::::.
+ :::::::::::
+ ':::::::::::..
+ :::::::::::::::'
+ ':::::::::::.
+ .::::::::::::::'
+ .:::::::::::...
+ ::::::::::::::''
+ .:::. '::::::::''::::
+ .::::::::. ':::::' '::::
+ .::::':::::::. ::::: '::::.
+ .:::::' ':::::::::. ::::: ':::.
+ .:::::' ':::::::::.::::: '::.
+ .::::'' ':::::::::::::: '::.
+ .::'' ':::::::::::: :::...
+ ..:::: ':::::::::' .:' ''''
+ ..''''':' ':::::.'
diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/DeviceMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/DeviceMapper.xml
new file mode 100644
index 0000000..ccb91d3
--- /dev/null
+++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/DeviceMapper.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/DeviceParamMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/DeviceParamMapper.xml
new file mode 100644
index 0000000..92ab12c
--- /dev/null
+++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/DeviceParamMapper.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/PlanMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/PlanMapper.xml
index 4cb6c9b..8303f27 100644
--- a/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/PlanMapper.xml
+++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/PlanMapper.xml
@@ -16,7 +16,7 @@
-