问题单修复

This commit is contained in:
zhuxinyu
2023-04-25 09:49:28 +08:00
parent a8a97f0f4c
commit 7ba970bc56
9 changed files with 56 additions and 55 deletions

View File

@@ -101,7 +101,7 @@ FROM
a.level,
h.ip,
ifnull(f.Flow,(select flow from cld_flow_meal where type = 0 and flag = 1)) baseFlowMeal,
g.Flag reamFlowMeal
ifnull(g.Flag,0) reamFlowMeal
FROM
pq_line a
inner join pq_device h on a.id = h.id

View File

@@ -22,6 +22,9 @@ public class GeneralVO implements Serializable {
@ApiModelProperty(name = "name",value = "监测点名称/电压等级")
private String name;
@ApiModelProperty(name = "name",value = "电压等级")
private Double vol;
@Excel(name = "在线")
@ApiModelProperty(name = "onLine",value = "在线数量")
private Integer onLine;

View File

@@ -54,6 +54,8 @@ import com.njcn.event.service.majornetwork.ReportService;
import com.njcn.event.utils.EchartsUtil;
import com.njcn.event.utils.FreemarkerUtil;
import com.njcn.event.utils.WordUtils;
import com.njcn.harmonic.pojo.vo.ComAssessVO;
import com.njcn.influxdb.mapper.InfluxDBResultMapperCn;
import com.njcn.influxdb.utils.InfluxDBCommUtils;
import com.njcn.influxdb.utils.InfluxDbUtils;
import com.njcn.poi.util.PoiUtil;
@@ -233,7 +235,7 @@ public class ReportServiceImpl implements ReportService {
// QueryResult queryResult = new QueryResult();
ArrayList<GeneralVO> list = new ArrayList<>();
for (GeneralDeviceDTO dto : data) {
list.add(new GeneralVO(dto.getName(), 0, 0, 0, 0, 0));
list.add(new GeneralVO(dto.getName(), 0.0,0, 0, 0, 0, 0));
// queryResult = null;
// StringBuilder stringBuilder = new StringBuilder(Param.SELECT).append(Param.EVENT_DETAIL);
@@ -305,15 +307,14 @@ public class ReportServiceImpl implements ReportService {
}
Map<String, String> dictMap = dictType.stream().collect(Collectors.toMap(DictData::getId, DictData::getCode));
//查电压
HttpResult<List<GeneralDeviceDTO>> info = generalDeviceInfoClient.getPracticalAllDeviceInfo(businessParam);
List<GeneralDeviceDTO> data = info.getData();
List<GeneralDeviceDTO> data = generalDeviceInfoClient.getPracticalAllDeviceInfo(businessParam).getData();
//所有根据line_id查询出来的数据
HashMap<String, List<EventDetail>> map = new HashMap<>();
//循环查找所有数据
// QueryResult queryResult = new QueryResult();
ArrayList<GeneralVO> list = new ArrayList<>();
for (GeneralDeviceDTO dto : data) {
list.add(new GeneralVO(dto.getName(), 0, 0, 0, 0, 0));
list.add(new GeneralVO(dto.getName(), 0.0,0, 0, 0, 0, 0));
// queryResult = null;
// StringBuilder stringBuilder = new StringBuilder(Param.SELECT + Param.EVENT_DETAIL);
List<String> lineIndexes = dto.getLineIndexes();
@@ -366,7 +367,9 @@ public class ReportServiceImpl implements ReportService {
generalVO.setOffLine(dto.getLineIndexes().size() - result.getData());
}
}
return list;
list.forEach(item -> item.setVol(Double.parseDouble(item.getName().substring(0,item.getName().indexOf("k")))));
List<GeneralVO> sortedList = list.stream().sorted(Comparator.comparing(GeneralVO::getVol)).collect(Collectors.toList());
return sortedList;
}
/**

View File

@@ -20,9 +20,11 @@ import org.influxdb.dto.QueryResult;
import org.influxdb.impl.InfluxDBResultMapper;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@@ -37,8 +39,6 @@ public class ComAssessServiceImpl extends ServiceImpl<RStatComassesDMapper, RSta
private final GeneralDeviceInfoClient generalDeviceInfoClient;
private final InfluxDbUtils influxDbUtils;
private final HarmonicComAssesUtil comAssesUtil;
@Override
@@ -93,7 +93,8 @@ public class ComAssessServiceImpl extends ServiceImpl<RStatComassesDMapper, RSta
comAssessVOList.add(comAssessVO);
}
}
return comAssessVOList;
List<ComAssessVO> list = comAssessVOList.stream().sorted(Comparator.comparing(ComAssessVO::getData).reversed()).collect(Collectors.toList());
return list;
}
//设置保留四位小数

View File

@@ -177,10 +177,9 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
List<PollutionVO> list = new ArrayList<>();
String pollutionType = harmonicPublicParam.getStatisticalType ().getId ();
String searchBeginTime = harmonicPublicParam.getSearchBeginTime ().substring (0,10);
if (StringUtils.isBlank(RequestUtil.getDeptIndex())){
if (StringUtils.isBlank(RequestUtil.getDeptIndex())) {
return list;
}
if (harmonicPublicParam.getType() != 0) {
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
pmsDeviceInfoParam.setDeptIndex(harmonicPublicParam.getDeptIndex());
@@ -188,7 +187,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
pmsDeviceInfoParam.setStatisticalType(harmonicPublicParam.getStatisticalType());
//获取主网台账信息
List<PmsGeneralDeviceDTO> deviceList = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
deviceList.forEach(temp->{
deviceList.forEach(temp -> {
PollutionVO pollutionVO = new PollutionVO ();
String detpid = temp.getIndex ();
String name =temp.getName ();
@@ -197,8 +196,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
pollutionVO.setName (name);
pollutionVO.setData (-1.0);
setData(harmonicPublicParam, pollutionType, searchBeginTime, pollutionVO, detpid);
if(CollectionUtil.isNotEmpty(powers)){
if(CollectionUtil.isNotEmpty(powers)) {
//子集变电站
List<PollutionVO> powersVO = new ArrayList<>();
PmsStatationStatInfoParam param=new PmsStatationStatInfoParam();
@@ -209,7 +207,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
(Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(o -> o.getPowerId()))), ArrayList::new));
Map<String, Double> stringDoubleMap = setPmsSubData(harmonicPublicParam, pollutionType, searchBeginTime, powers);
if(CollectionUtil.isNotEmpty(data)){
if(CollectionUtil.isNotEmpty(data)) {
dsData.forEach(power->{
PollutionVO pollutionsubVO = new PollutionVO ();
pollutionsubVO.setId (power.getPowerId());
@@ -229,41 +227,35 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
list.add (pollutionVO);
});
}else{
} else {
harmonicPublicParam.setServerName(generalInfo.getMicroServiceName());
List<GeneralDeviceDTO> sub = generalDeviceInfoClient.getPracticalRunDeviceInfo(harmonicPublicParam).getData();
sub.forEach (temp ->{
PollutionVO pollutionVO = new PollutionVO ();
String detpid = temp.getIndex ();
String name =temp.getName ();
List<String> subIndexes = temp.getSubIndexes ( );
pollutionVO.setId (detpid);
pollutionVO.setName (name);
pollutionVO.setData (-1.0);
for (GeneralDeviceDTO temp : sub) {
PollutionVO pollutionVO = new PollutionVO();
String detpid = temp.getIndex();
String name = temp.getName();
List<String> subIndexes = temp.getSubIndexes();
pollutionVO.setId(detpid);
pollutionVO.setName(name);
pollutionVO.setData(-1.0);
setData(harmonicPublicParam, pollutionType, searchBeginTime, pollutionVO, detpid);
List<PollutionVO> subPollutionVO = new ArrayList<>();
subIndexes.forEach (subIndex->{
PollutionVO pollutionsubVO = new PollutionVO ();
subIndexes.forEach(subIndex -> {
PollutionVO pollutionsubVO = new PollutionVO();
PollutionSubstationDTO pollutionSubstationDTO = lineFeignClient.getSubstationInfo(subIndex).getData();
String id = pollutionSubstationDTO.getId ( );
pollutionsubVO.setId (id);
pollutionsubVO.setName ( pollutionSubstationDTO.getName ());
pollutionsubVO.setPid (temp.getIndex ());
pollutionsubVO.setData (-1.0);
String id = pollutionSubstationDTO.getId();
pollutionsubVO.setId(id);
pollutionsubVO.setName(pollutionSubstationDTO.getName());
pollutionsubVO.setPid(temp.getIndex());
pollutionsubVO.setData(-1.0);
setSubData(harmonicPublicParam, pollutionType, searchBeginTime, pollutionsubVO, id);
subPollutionVO.add (pollutionsubVO) ;
subPollutionVO.add(pollutionsubVO);
});
pollutionVO.setChildren (subPollutionVO);
pollutionVO.setChildren(subPollutionVO);
list.add (pollutionVO);
});
list.add(pollutionVO);
}
}
if (!CollectionUtils.isEmpty(list)){
return list.stream().sorted(Comparator.comparing(PollutionVO::getData).reversed().thenComparing(PollutionVO::getName)).collect(Collectors.toList());
}
@@ -305,6 +297,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
}
private void setSubData(HarmonicPublicParam harmonicPublicParam, String pollutionType, String searchBeginTime, PollutionVO pollutionsubVO, String id) {
harmonicPublicParam.setReportFlag("5");
if(Objects.equals (harmonicPublicParam.getReportFlag (), BizParamConstant.STAT_BIZ_YEAR) ){
QueryWrapper<RStatPollutionSubstationYPO> wrapper = new QueryWrapper<> ();
wrapper.eq ("substation_id",id).
@@ -342,40 +335,34 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
}
private void setData(HarmonicPublicParam harmonicPublicParam, String pollutionType, String searchBeginTime, PollutionVO pollutionVO, String detpid) {
if(Objects.equals (harmonicPublicParam.getReportFlag (), BizParamConstant.STAT_BIZ_YEAR) ){
harmonicPublicParam.setReportFlag("5");
if(Objects.equals (harmonicPublicParam.getReportFlag (), BizParamConstant.STAT_BIZ_YEAR) ) {
QueryWrapper<RStatPollutionOrgYPO> rStatPollutionOrgYPOQueryWrapper = new QueryWrapper<> ();
rStatPollutionOrgYPOQueryWrapper.eq ("org_id", detpid).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
RStatPollutionOrgYPO rStatPollutionOrgYPO = rStatPollutionOrgYPOMapper.selectOne (rStatPollutionOrgYPOQueryWrapper);
;
Optional.ofNullable (rStatPollutionOrgYPO).ifPresent (a->pollutionVO.setData (a.getValue ()));
}else if(Objects.equals (harmonicPublicParam.getReportFlag (),BizParamConstant.STAT_BIZ_QUARTER)){
} else if (Objects.equals (harmonicPublicParam.getReportFlag (),BizParamConstant.STAT_BIZ_QUARTER)) {
QueryWrapper<RStatPollutionOrgQPO> rStatPollutionOrgQPOQueryWrapper = new QueryWrapper<> ();
rStatPollutionOrgQPOQueryWrapper.eq ("org_id", detpid).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
RStatPollutionOrgQPO rStatPollutionOrgQPO = rStatPollutionOrgQPOMapper.selectOne (rStatPollutionOrgQPOQueryWrapper);
;
Optional.ofNullable (rStatPollutionOrgQPO).ifPresent (a->pollutionVO.setData (a.getValue ()));
}else if(Objects.equals (harmonicPublicParam.getReportFlag (),BizParamConstant.STAT_BIZ_MONTH)){
} else if (Objects.equals (harmonicPublicParam.getReportFlag (),BizParamConstant.STAT_BIZ_MONTH)) {
QueryWrapper<RStatPollutionOrgMPO> rStatPollutionOrgMPOQueryWrapper = new QueryWrapper<> ();
rStatPollutionOrgMPOQueryWrapper.eq ("org_id", detpid).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
RStatPollutionOrgMPO rStatPollutionOrgMPO = rStatPollutionOrgMPOMapper.selectOne (rStatPollutionOrgMPOQueryWrapper);
;
Optional.ofNullable (rStatPollutionOrgMPO).ifPresent (a->pollutionVO.setData (a.getValue ()));
}else if(Objects.equals (harmonicPublicParam.getReportFlag (),BizParamConstant.STAT_BIZ_DAY)){
} else if (Objects.equals (harmonicPublicParam.getReportFlag (),BizParamConstant.STAT_BIZ_DAY)) {
QueryWrapper<RStatPollutionOrgDPO> rStatPollutionOrgDPOQueryWrapper = new QueryWrapper<> ();
rStatPollutionOrgDPOQueryWrapper.eq ("org_id", detpid).
eq ("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",searchBeginTime);
RStatPollutionOrgDPO rStatPollutionOrgDPO = rStatPollutionOrgDPOMapper.selectOne (rStatPollutionOrgDPOQueryWrapper);
;
Optional.ofNullable (rStatPollutionOrgDPO).ifPresent (a->pollutionVO.setData (a.getValue ()));
}
}

View File

@@ -21,7 +21,7 @@ public class DeviceAbnormalStatisticsJob {
@XxlJob("deviceAbnormalStatisticsJob")
public void deviceAbnormalStatisticsJob () {
String time = LocalDate.now().minusDays(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
String time = LocalDate.now().minusDays(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
log.info("执行日期deviceAbnormalStatisticsJob===============>"+time);
DeviceAbnormaStatisticsParam param =new DeviceAbnormaStatisticsParam();
param.setTime(time);

View File

@@ -5,7 +5,7 @@ import com.njcn.prepare.harmonic.pojo.influxdb.po.Communicate;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
@@ -15,7 +15,7 @@ public class TopMsgPO extends BaseEntity {
/**
* 日期
*/
private String time;
private Date time;
/**
* 装置id

View File

@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class DeviceAbnormaStatisticsParam implements Serializable {

View File

@@ -95,6 +95,12 @@ public class DeviceAbnormaStatisticsServiceImpl implements DeviceAbnormalStatist
topMsg.setFlowFlag(1);
topMsg.setOnlineRateFlag(1);
topMsg.setAlarmCountFlag(1);
try {
topMsg.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(param.getTime()));
} catch (ParseException e) {
log.error("ParseException: "+e);
e.printStackTrace();
}
int deviceLevel = devEntry.getValue().stream().mapToInt(AlarmPO::getLevel).min().orElse(-1);
// 装置等级
topMsg.setDeviceLevel(deviceLevel);