Browse Source

#bug修改

zhongwei
yang_shj 2 years ago
parent
commit
2a2c5ce884
  1. 5
      hzims-service/operational/pom.xml
  2. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AnalyseDataServiceImpl.java
  3. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java
  4. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java
  5. 16
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  6. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java
  7. 23
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java
  8. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java
  9. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationAttributeServiceImpl.java
  10. 3
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/properties/TicketProperties.java

5
hzims-service/operational/pom.xml

@ -33,6 +33,11 @@
<!-- </dependency>-->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.3</version>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-boot</artifactId>
</dependency>

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AnalyseDataServiceImpl.java

@ -12,6 +12,7 @@ import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO;
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
@ -30,6 +31,7 @@ import java.util.stream.Collectors;
*/
@Service
@AllArgsConstructor
@Slf4j
public class AnalyseDataServiceImpl implements IAnalyseDataService {
private final IAnalyseDataSearchClient analyseDataSearchClient;
@ -82,8 +84,8 @@ public class AnalyseDataServiceImpl implements IAnalyseDataService {
* 指标数据列表查询
* @param startTime 开始时间
* @param endTime 结束时间
* @param accessRules 间隔周期 : 0-> 1-> 2-> 小时 3-> 4-> 5-> 6->
* @param cycleType 取数规则 : 0=最早值 1=最大值 2=最小值 3=平均值 4=和值 5=差值 6=最新值
* @param accessRules 取数规则 : 0=最早值 1=最大值 2=最小值 3=平均值 4=和值 5=差值 6=最新值
* @param cycleType 间隔周期 : 0-> 1-> 2-> 小时 3-> 4-> 5-> 6->
* @param deviceCode 设备编号
* @param ride 配电比
* @param signages 指标

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java

@ -438,7 +438,7 @@ public class HomePageServiceImpl implements IHomePageService {
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND));
start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
float currentYearPowerGeneration = this.generateByDevices(effEmInfoList, start+ " 00:00:00", end + " 00:00:00",6);;
float currentYearPowerGeneration = this.generateByDevices(effEmInfoList, start+ " 00:00:00", end + " 00:00:00",6);
powerStationTotalVo.setCurrentYearPowerGeneration(currentYearPowerGeneration);
// 当日发电量
float currentDayPowerGeneration = this.generateByDevices(effEmInfoList, getCurrentTime() + " 00:00:00", getAddDayTime(1) + " 00:00:00",3);
@ -465,7 +465,7 @@ public class HomePageServiceImpl implements IHomePageService {
return generate;
}
for(EminfoAndEmParamVo device : devices ){
generate += analyseDataService.periodTargetFloat(start,end,accessRules,5,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
generate += analyseDataService.periodTargetFloat(start,end,5,accessRules,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
};
return generate;
}

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java

@ -246,7 +246,7 @@ public class HomeServiceImpl implements HomeService {
double plan = list.stream().mapToDouble(PowerEntity::getPlannedPowerMon).sum();
double pass = list.stream().mapToDouble(power -> Double.parseDouble(power.getDoubleQualifyRate())).sum();
// 装机容量
target.setTaget_one(list.get(0).getInstalledCapacity());
target.setTaget_one(list.stream().map(PowerEntity::getInstalledCapacity).collect(Collectors.toSet()).stream().mapToDouble(Double::valueOf).sum());
// 发电量
target.setTaget_two(list.stream().mapToDouble(PowerEntity::getPowerMon).sum());
if(Math.abs(plan) > 0){
@ -254,7 +254,7 @@ public class HomeServiceImpl implements HomeService {
target.setTaget_three(BigDecimal.valueOf(target.getTaget_two() / plan * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
// 双票合格率
target.setTaget_four(BigDecimal.valueOf(pass / list.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
target.setTaget_four(BigDecimal.valueOf(pass / list.size()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
return target;
}

16
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -40,6 +40,7 @@ import com.hnac.hzinfo.inspect.task.feign.IInspectTaskReportClient;
import com.hnac.hzinfo.inspect.task.vo.DutyInspectTaskVO;
import com.hnac.hzinfo.sdk.core.response.Result;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
@ -70,6 +71,7 @@ import java.util.stream.Collectors;
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class HydropowerServiceImpl implements HydropowerService {
private final AreaService areaService;
@ -505,7 +507,7 @@ public class HydropowerServiceImpl implements HydropowerService {
default:
throw new IllegalStateException("Unexpected value: " + scope);
}
return analyseDataService.periodTargetFloat(start,end,accessRules,5,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
return analyseDataService.periodTargetFloat(start,end,5,accessRules,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
}
/**
@ -516,7 +518,7 @@ public class HydropowerServiceImpl implements HydropowerService {
private List<GenerationPowerVo> 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<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
if(CollectionUtil.isEmpty(records)){
return new ArrayList<>();
}
@ -1128,13 +1130,13 @@ public class HydropowerServiceImpl implements HydropowerService {
// 返回结果集
if(Math.abs(generate_sum) > 0){
return scales.stream().peek(scale-> scale.setAreaMakeUp(BigDecimal.valueOf(scale.getPowerYear() / generate_sum * 100).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue())).
/*filter(scale-> Math.abs(scale.getCapacityUse()) > 0 || Math.abs(scale.getAreaMakeUp()) > 0
&& Math.abs(scale.getDeviceUse()) > 0 || Math.abs(scale.getGenerationRate()) > 0)
.*/sorted(Comparator.comparing(AreaScaleVo::getPowerYear).reversed()).collect(Collectors.toList());
filter(scale-> Math.abs(scale.getCapacityUse()) > 0 || Math.abs(scale.getAreaMakeUp()) > 0
&& Math.abs(scale.getDeviceUse()) > 0 || Math.abs(scale.getGenerationRate()) > 0)
.sorted(Comparator.comparing(AreaScaleVo::getPowerYear).reversed()).collect(Collectors.toList());
}
return scales.stream().peek(scale-> scale.setAreaMakeUp(0.0))./*filter(scale-> Math.abs(scale.getCapacityUse()) > 0 || Math.abs(scale.getAreaMakeUp()) > 0
return scales.stream().peek(scale-> scale.setAreaMakeUp(0.0)).filter(scale-> Math.abs(scale.getCapacityUse()) > 0 || Math.abs(scale.getAreaMakeUp()) > 0
&& Math.abs(scale.getDeviceUse()) > 0 || Math.abs(scale.getGenerationRate()) > 0)
.*/sorted(Comparator.comparing(AreaScaleVo::getPowerYear).reversed()).collect(Collectors.toList());
.sorted(Comparator.comparing(AreaScaleVo::getPowerYear).reversed()).collect(Collectors.toList());
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java

@ -515,7 +515,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
return generate;
}
for(EminfoAndEmParamVo device : devices ){
generate += analyseDataService.periodTargetFloat(DateUtil.format(start,DateUtil.PATTERN_DATETIME),DateUtil.format(end,DateUtil.PATTERN_DATETIME),3,5,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
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);
}
return generate;
}

23
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java

@ -34,6 +34,7 @@ import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
@ -59,6 +60,7 @@ import java.util.stream.Collectors;
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class WaterServiceImpl implements IWaterService {
private final UseService useService;
@ -257,25 +259,16 @@ public class WaterServiceImpl implements IWaterService {
List<String> signages = Collections.singletonList(signage);
realData.setSignages(signages);
// 调用fegin接口查询实时数据
R<List<FieldsData>> R;
try {
R = analyseDataSearchClient.getRealDataByAnalyzeCode(realData);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
R<List<FieldsData>> R = analyseDataSearchClient.getRealDataByAnalyzeCode(realData);
if(!R.isSuccess() || CollectionUtil.isEmpty(R.getData())){
return 0.0;
}
// 质量
if(!R.getData().get(0).getQ().equals(0)){
return 0.0;
}
// 时间限制
String time = R.getData().get(0).getTime();
if(StringUtil.isBlank(time)){
if(StringUtil.isEmpty(time) || "-".equals(time)){
return 0.0;
}
Date date = DateUtil.parse(time,DateUtil.DATETIME_FORMAT);
Date date = DateUtil.parse(time, "yyyy-MM-dd HH:mm:ss.sss");
if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){
return 0.0;
}
@ -548,7 +541,7 @@ public class WaterServiceImpl implements IWaterService {
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1);
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
// 当年用电量
return analyseDataService.periodTargetFloat(start,end,6,5,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION);
return analyseDataService.periodTargetFloat(start,end,5,6,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION);
}
/**
@ -571,7 +564,7 @@ public class WaterServiceImpl implements IWaterService {
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",3,5,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION);
return analyseDataService.periodTargetFloat(time + " 00:00:00",time + " 23:59:59",5,3,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION);
}
@ -725,7 +718,7 @@ public class WaterServiceImpl implements IWaterService {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH,-29);
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),5,device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION);
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION);
if(CollectionUtil.isEmpty(records)){
return new ArrayList<>();
}

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java

@ -175,6 +175,7 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
if(CollectionUtil.isEmpty(realIds)){
return;
}
log.error("real_time_data: {},{}",stationReal.getStation(),realIds);
List<String> objects = redisClient.getBatchRealDataByRealId(stationReal.getStation(),realIds);
for(int i = 0; i < realIds.size() ;i++){
if(ObjectUtil.isEmpty(objects.get(i))){

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationAttributeServiceImpl.java

@ -191,6 +191,8 @@ public class StationAttributeServiceImpl extends BaseServiceImpl<StationAttribut
return list.stream().collect(Collectors.toMap(StationAttributeEntity::getAttributes, StationAttributeEntity::getUnit));
}
@Override
public void removeByStationCode(String stationCode) {
LambdaQueryWrapper<StationAttributeEntity> queryWrapper = Wrappers.<StationAttributeEntity>lambdaQuery().eq(StationAttributeEntity::getStationId, stationCode);

3
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/properties/TicketProperties.java

@ -1,6 +1,5 @@
package com.hnac.hzims.ticket.processflow.properties;
import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.boot.context.properties.ConfigurationProperties;
@ -19,7 +18,7 @@ import java.util.List;
@Data
@Accessors(chain = true)
@Component
@NacosPropertySource(dataId = "hzims-ticket-dev.yaml", autoRefreshed = true)
//@NacosPropertySource(dataId = "hzims-ticket-dev.yaml", autoRefreshed = true)
@ConfigurationProperties(prefix = "ticket")
@RefreshScope
public class TicketProperties {

Loading…
Cancel
Save