diff --git a/hzims-service/inspect/pom.xml b/hzims-service/inspect/pom.xml
index 0cd8536..d67566d 100644
--- a/hzims-service/inspect/pom.xml
+++ b/hzims-service/inspect/pom.xml
@@ -148,7 +148,7 @@
org.springblade
blade-starter-oss-minio
- 2.7.3.RELEASE
+ ${bladex.project.version}
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java
index efdc489..d56d5fe 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java
@@ -17,11 +17,12 @@ import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.beans.BeanUtils;
-import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
+import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@@ -38,6 +39,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl list(IPage page, String type) {
- List stations = stationService.getStationByType(HomePageConstant.HYDROPOWER,HomePageConstant.HYDROPOWER_SERVETYPE);
- if(CollectionUtil.isEmpty(stations)){
+ List stations = stationService.getStationByType(HomePageConstant.HYDROPOWER, HomePageConstant.HYDROPOWER_SERVETYPE);
+ if (CollectionUtil.isEmpty(stations)) {
return null;
}
- List result = this.baseMapper.selectPageList(page,type,stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
+ List result = this.baseMapper.selectPageList(page, type, stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
page.setRecords(result);
return page;
}
@@ -73,14 +75,16 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl getAlarmTime(Query query, HistoryAbnormalAlarmEntity entity) {
- List historyAbnormalAlarmVos= this.baseMapper.getAlarmEntity(entity.getType(),entity.getStationName(),entity.getStartTime(),entity.getEndTime());
- if (historyAbnormalAlarmVos==null){
+ QueryWrapper alarmEntityQueryWrapper = getAlarmEntityQueryWrapper(entity);
+ List historyAbnormalAlarmEntity = this.baseMapper.selectList(alarmEntityQueryWrapper);
+ if (historyAbnormalAlarmEntity == null) {
return null;
}
+ List historyAbnormalAlarmVos = BeanUtil.copy(historyAbnormalAlarmEntity, HistoryAbnormalAlarmVo.class);
//赋值空的endTime
- if(ObjectUtils.isNotEmpty(entity.getEndTime())){
- historyAbnormalAlarmVos.stream().filter(s->s.getEndTime()==null).forEach(s->s.setEndTime(entity.getEndTime()));
- }else {
+ if (ObjectUtils.isNotEmpty(entity.getEndTime())) {
+ historyAbnormalAlarmVos.stream().filter(s -> s.getEndTime() == null).forEach(s -> s.setEndTime(entity.getEndTime()));
+ } else {
historyAbnormalAlarmVos.stream().filter(s -> s.getEndTime() == null).forEach(s -> s.setEndTime(new Date()));
}
List voList = historyAbnormalAlarmVos.parallelStream().map(s -> {
@@ -93,8 +97,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl durationList = voList.stream().collect(Collectors.groupingBy(HistoryAbnormalAlarmEntity::getStationName,
Collectors.summingLong(HistoryAbnormalAlarmVo::getTimes)));
-
- List res=new ArrayList<>();
+ List res = new ArrayList<>();
for (Map.Entry entry : durationList.entrySet()) {
//累计时长
double v = BigDecimal.valueOf(entry.getValue() / (1000 * 60 * 60.00)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
@@ -103,23 +106,23 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl page = Condition.getPage(query);
page.setTotal(res.size());
- if (query==null){
+ if (entityIsNull(query)) {
page.setRecords(res);
- }else {
- if (res.size()>query.getCurrent()* query.getSize()) {
+ } else {
+ if (res.size() > query.getCurrent() * query.getSize()) {
page.setRecords(res.subList((query.getCurrent() - 1) * query.getSize(), query.getCurrent() * query.getSize()));
- }else {
+ } else {
page.setRecords(res.subList((query.getCurrent() - 1) * query.getSize(), res.size()));
}
}
@@ -129,26 +132,42 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl getAlarmEntityQueryWrapper(HistoryAbnormalAlarmEntity entity) {
QueryWrapper queryWrapper = new QueryWrapper<>();
- if (entity.getStationName()!=null) {
+ if (entity.getStationName() != null) {
queryWrapper.lambda().eq(HistoryAbnormalAlarmEntity::getStationName, entity.getStationName());
}
- if (entity.getType()!=null) {
+ if (entity.getType() != null) {
queryWrapper.lambda().eq(HistoryAbnormalAlarmEntity::getType, entity.getType());
}
- if (entity.getStartTime()!=null) {
+ if (entity.getStartTime() != null) {
queryWrapper.lambda().le(HistoryAbnormalAlarmEntity::getStartTime, entity.getStartTime());
}
- if (entity.getEndTime()!=null) {
+ if (entity.getEndTime() != null) {
queryWrapper.lambda().ge(HistoryAbnormalAlarmEntity::getStartTime, entity.getEndTime());
}
return queryWrapper;
}
@Override
- public IPage queryByEntity(HistoryAbnormalAlarmEntity entity,Query query) {
+ public IPage queryByEntity(HistoryAbnormalAlarmEntity entity, Query query) {
QueryWrapper alarmEntityQueryWrapper = getAlarmEntityQueryWrapper(entity);
IPage historyAbnormalAlarmEntityIPage = this.baseMapper.selectPage(Condition.getPage(query), alarmEntityQueryWrapper);
return historyAbnormalAlarmEntityIPage;
}
+ private Boolean entityIsNull(Object object) {
+ if (null == object) {
+ return true;
+ }
+ try {
+ for (Field f : object.getClass().getDeclaredFields()) {
+ f.setAccessible(true);
+ if (f.get(object) != null && StringUtils.isNotBlank(f.get(object).toString())) {
+ return false;
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return true;
+ }
}
diff --git a/hzims-service/operational/src/main/resources/log/logback-dev.xml b/hzims-service/operational/src/main/resources/log/logback-dev.xml
deleted file mode 100644
index c67cdd9..0000000
--- a/hzims-service/operational/src/main/resources/log/logback-dev.xml
+++ /dev/null
@@ -1,127 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ${CONSOLE_LOG_PATTERN}
- utf8
-
-
-
-
-
-
-
-
- log/info.log
-
-
- log/info/info-%d{yyyy-MM-dd_HH}.%i.log
-
- 240
-
- 20MB
- 10GB
- true
-
-
- ${log.pattern}
-
-
-
- INFO
- ACCEPT
- DENY
-
-
-
-
-
- log/error.log
-
-
- log/error/error-%d{yyyy-MM-dd_HH}.%i.log
-
- 360
-
- 20MB
- 10GB
- true
-
-
- ${log.pattern}
-
-
-
- ERROR
- ACCEPT
- DENY
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/hzims-service/operational/src/main/resources/log/logback-prod.xml b/hzims-service/operational/src/main/resources/log/logback-prod.xml
deleted file mode 100644
index 3083e23..0000000
--- a/hzims-service/operational/src/main/resources/log/logback-prod.xml
+++ /dev/null
@@ -1,127 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ${CONSOLE_LOG_PATTERN}
- utf8
-
-
-
-
-
-
-
-
- log/info.log
-
-
- log/info/info-%d{yyyy-MM-dd_HH}.%i.log
-
- 240
-
- 20MB
- 10GB
- true
-
-
- ${log.pattern}
-
-
-
- INFO
- ACCEPT
- DENY
-
-
-
-
-
- log/error.log
-
-
- log/error/error-%d{yyyy-MM-dd_HH}.%i.log
-
- 360
-
- 20MB
- 10GB
- true
-
-
- ${log.pattern}
-
-
-
- ERROR
- ACCEPT
- DENY
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/hzims-service/operational/src/main/resources/log/logback-test.xml b/hzims-service/operational/src/main/resources/log/logback-test.xml
deleted file mode 100644
index fb3de3c..0000000
--- a/hzims-service/operational/src/main/resources/log/logback-test.xml
+++ /dev/null
@@ -1,127 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ${CONSOLE_LOG_PATTERN}
- utf8
-
-
-
-
-
-
-
-
-
-
- log/error.log
-
-
- log/error/error-%d{yyyy-MM-dd_HH}.%i.log
-
- 360
-
- 20MB
- 10GB
- true
-
-
- ${log.pattern}
-
-
-
- ERROR
- ACCEPT
- DENY
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/hzims-service/topvision/topvision.iml b/hzims-service/topvision/topvision.iml
deleted file mode 100644
index 31b330c..0000000
--- a/hzims-service/topvision/topvision.iml
+++ /dev/null
@@ -1,319 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file