1.无线设bug修改
2.添加测试项每日扫描功能
This commit is contained in:
@@ -195,5 +195,17 @@ public class WlRecordController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, record, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, record, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每日处理没有结束时间的测试基础数据
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
|
@PostMapping("/dayDealNoEndTimeEvent")
|
||||||
|
@ApiOperation("每日处理没有结束时间的测试基础数据")
|
||||||
|
public void dayDealNoEndTimeEvent() {
|
||||||
|
String methodDescribe = getMethodDescribe("dayDealNoEndTimeEvent");
|
||||||
|
wlRecordService.dayDealNoEndTimeEvent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
<if test="wlRecordPageParam.isTrueFlag == 0">
|
<if test="wlRecordPageParam.isTrueFlag == 0">
|
||||||
select a.dev_id as id,b.name as name from wl_record a
|
select a.dev_id as id,b.name as name from wl_record a
|
||||||
left join cs_equipment_delivery b on a.dev_id = b.id
|
left join cs_equipment_delivery b on a.dev_id = b.id
|
||||||
where a.type=1 and a.state =1 and
|
where a.type=1 and a.state =1 and a.end_time is not null
|
||||||
|
and
|
||||||
(select count(1) from wl_record wl where wl.dev_id = a.dev_id) >
|
(select count(1) from wl_record wl where wl.dev_id = a.dev_id) >
|
||||||
(select count(1) from wl_record_test_data wd where wd.test_item_id = #{wlRecordPageParam.id}
|
(select count(1) from wl_record_test_data wd where wd.test_item_id = #{wlRecordPageParam.id}
|
||||||
and data_id in (select w.id from wl_record w where w.dev_id = a.dev_id))
|
and data_id in (select w.id from wl_record w where w.dev_id = a.dev_id))
|
||||||
@@ -32,7 +33,8 @@
|
|||||||
<if test="wlRecordPageParam.isTrueFlag == 1">
|
<if test="wlRecordPageParam.isTrueFlag == 1">
|
||||||
select a.dev_id as id,b.name as name from wl_record a
|
select a.dev_id as id,b.name as name from wl_record a
|
||||||
left join cs_equipment_delivery b on a.dev_id = b.id
|
left join cs_equipment_delivery b on a.dev_id = b.id
|
||||||
where a.type=1 and a.state =1 and exists
|
where a.type=1 and a.state =1 and a.end_time is not null
|
||||||
|
and exists
|
||||||
(select 1 from wl_record wl where wl.dev_id = a.dev_id and wl.type=1 and wl.state =1
|
(select 1 from wl_record wl where wl.dev_id = a.dev_id and wl.type=1 and wl.state =1
|
||||||
and exists (select 1 from wl_record_test_data wd where wd.test_item_id = #{wlRecordPageParam.id} and wd.data_id = wl.id))
|
and exists (select 1 from wl_record_test_data wd where wd.test_item_id = #{wlRecordPageParam.id} and wd.data_id = wl.id))
|
||||||
group by a.dev_id,b.name having a.dev_id is not null and b.name is not null
|
group by a.dev_id,b.name having a.dev_id is not null and b.name is not null
|
||||||
@@ -55,7 +57,7 @@
|
|||||||
<select id="getRecordAllTime" resultType="com.njcn.csdevice.pojo.vo.RecordAllDevTreeVo$RecordAllTimeTreeVo">
|
<select id="getRecordAllTime" resultType="com.njcn.csdevice.pojo.vo.RecordAllDevTreeVo$RecordAllTimeTreeVo">
|
||||||
select a.id as id,concat(a.start_time,'-',a.end_time) as name, concat(#{wlRecordPageParam.lineId},'-',#{wlRecordPageParam.devId}) as pid from wl_record a
|
select a.id as id,concat(a.start_time,'-',a.end_time) as name, concat(#{wlRecordPageParam.lineId},'-',#{wlRecordPageParam.devId}) as pid from wl_record a
|
||||||
left join cs_line c on a.line_id = c.line_id
|
left join cs_line c on a.line_id = c.line_id
|
||||||
where a.type=1 and a.state =1 and a.dev_id=#{wlRecordPageParam.devId} and a.line_id=#{wlRecordPageParam.lineId}
|
where a.type=1 and a.state =1 and a.end_time is not null and a.dev_id=#{wlRecordPageParam.devId} and a.line_id=#{wlRecordPageParam.lineId}
|
||||||
and
|
and
|
||||||
<if test="wlRecordPageParam.isTrueFlag == 0">
|
<if test="wlRecordPageParam.isTrueFlag == 0">
|
||||||
not
|
not
|
||||||
|
|||||||
@@ -102,4 +102,10 @@ public interface IWlRecordService extends IService<WlRecord> {
|
|||||||
*/
|
*/
|
||||||
WlRecord findDevBaseData(WlRecordParam.Record param);
|
WlRecord findDevBaseData(WlRecordParam.Record param);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每日处理没有结束时间的测试基础数据
|
||||||
|
*/
|
||||||
|
void dayDealNoEndTimeEvent();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -392,6 +392,8 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
csEventUserQueryPage.setPageNum(commonStatisticalQueryParam.getPageNum());
|
csEventUserQueryPage.setPageNum(commonStatisticalQueryParam.getPageNum());
|
||||||
csEventUserQueryPage.setPageSize(commonStatisticalQueryParam.getPageSize());
|
csEventUserQueryPage.setPageSize(commonStatisticalQueryParam.getPageSize());
|
||||||
csEventUserQueryPage.setLineId(commonStatisticalQueryParam.getLineId());
|
csEventUserQueryPage.setLineId(commonStatisticalQueryParam.getLineId());
|
||||||
|
csEventUserQueryPage.setStartTime(commonStatisticalQueryParam.getStartTime());
|
||||||
|
csEventUserQueryPage.setEndTime(commonStatisticalQueryParam.getEndTime());
|
||||||
Page<DataGroupEventVO> csEventVOPage = eventFeignClient.pageQueryByLineId(csEventUserQueryPage).getData();
|
Page<DataGroupEventVO> csEventVOPage = eventFeignClient.pageQueryByLineId(csEventUserQueryPage).getData();
|
||||||
|
|
||||||
csEventVOPage.getRecords().forEach(temp->{
|
csEventVOPage.getRecords().forEach(temp->{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -30,19 +31,23 @@ import com.njcn.csdevice.service.IWlRecordService;
|
|||||||
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
||||||
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
||||||
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||||
|
import com.njcn.influx.imapper.CommonMapper;
|
||||||
import com.njcn.influx.pojo.bo.CommonQueryParam;
|
import com.njcn.influx.pojo.bo.CommonQueryParam;
|
||||||
|
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
||||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||||
|
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||||
import com.njcn.influx.service.CommonService;
|
import com.njcn.influx.service.CommonService;
|
||||||
import com.njcn.system.api.CsStatisticalSetFeignClient;
|
import com.njcn.system.api.CsStatisticalSetFeignClient;
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.sf.cglib.core.Local;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.time.LocalDateTime;
|
import java.time.*;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@@ -70,6 +75,8 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
|
|
||||||
private final CommonService commonService;
|
private final CommonService commonService;
|
||||||
|
|
||||||
|
private final CommonMapper commonMapper;
|
||||||
|
|
||||||
private final InfluxDbParamUtil influxDbParamUtil;
|
private final InfluxDbParamUtil influxDbParamUtil;
|
||||||
|
|
||||||
private final CsLinePOMapper csLinePOMapper;
|
private final CsLinePOMapper csLinePOMapper;
|
||||||
@@ -157,13 +164,13 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
public RecordVo.RecordItemVo getTestRecordById(String testRecordId) {
|
public RecordVo.RecordItemVo getTestRecordById(String testRecordId) {
|
||||||
RecordVo.RecordItemVo recordItemVo = new RecordVo.RecordItemVo();
|
RecordVo.RecordItemVo recordItemVo = new RecordVo.RecordItemVo();
|
||||||
List<RecordVo> recordVoList = new ArrayList<>();
|
List<RecordVo> recordVoList = new ArrayList<>();
|
||||||
LambdaQueryWrapper<WlRecord> qw = new LambdaQueryWrapper();
|
LambdaQueryWrapper<WlRecord> qw = new LambdaQueryWrapper<>();
|
||||||
qw.eq(WlRecord::getId,testRecordId).eq(WlRecord::getType,0).eq(WlRecord::getState,1);
|
qw.eq(WlRecord::getId,testRecordId).eq(WlRecord::getType,0).eq(WlRecord::getState,1);
|
||||||
List<WlRecord> list = this.baseMapper.selectList(qw);
|
List<WlRecord> list = this.baseMapper.selectList(qw);
|
||||||
WlRecord wlRecord = list.get(0);
|
WlRecord wlRecord = list.get(0);
|
||||||
//当前ID就是测试项ID直接返回
|
//当前ID就是测试项ID直接返回
|
||||||
if(wlRecord.getPId()!=null){
|
if(wlRecord.getPId()!=null){
|
||||||
qw = new LambdaQueryWrapper();
|
qw.clear();
|
||||||
qw.eq(WlRecord::getId,wlRecord.getPId()).eq(WlRecord::getType,0).eq(WlRecord::getState,1);
|
qw.eq(WlRecord::getId,wlRecord.getPId()).eq(WlRecord::getType,0).eq(WlRecord::getState,1);
|
||||||
List<WlRecord> wlRecordList = this.baseMapper.selectList(qw);
|
List<WlRecord> wlRecordList = this.baseMapper.selectList(qw);
|
||||||
recordItemVo.setDescribe(wlRecordList.get(0).getDescribe());
|
recordItemVo.setDescribe(wlRecordList.get(0).getDescribe());
|
||||||
@@ -177,9 +184,10 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
//反之则是方案ID 则返回该方案下所有的测试项信息
|
//反之则是方案ID 则返回该方案下所有的测试项信息
|
||||||
recordItemVo.setDescribe(wlRecord.getDescribe());
|
recordItemVo.setDescribe(wlRecord.getDescribe());
|
||||||
recordItemVo.setItemName(wlRecord.getItemName());
|
recordItemVo.setItemName(wlRecord.getItemName());
|
||||||
qw = new LambdaQueryWrapper();
|
qw.clear();
|
||||||
qw.eq(WlRecord::getPId,testRecordId).eq(WlRecord::getType,0).eq(WlRecord::getState,1).orderByAsc(WlRecord::getCreateTime);;
|
qw.eq(WlRecord::getPId,testRecordId).eq(WlRecord::getType,0).eq(WlRecord::getState,1).orderByAsc(WlRecord::getCreateTime);;
|
||||||
for (WlRecord wl : this.baseMapper.selectList(qw)){
|
List<WlRecord> wlRecordList = this.baseMapper.selectList(qw);
|
||||||
|
for (WlRecord wl : wlRecordList){
|
||||||
RecordVo recordVo = new RecordVo();
|
RecordVo recordVo = new RecordVo();
|
||||||
wl.setStartTime(getFirstTimeById(wl.getId()));
|
wl.setStartTime(getFirstTimeById(wl.getId()));
|
||||||
wl.setEndTime(getLastTimeById(wl.getId()));
|
wl.setEndTime(getLastTimeById(wl.getId()));
|
||||||
@@ -418,6 +426,96 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
return this.getOne(lambdaQueryWrapper);
|
return this.getOne(lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dayDealNoEndTimeEvent() {
|
||||||
|
LambdaQueryWrapper<WlRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(WlRecord::getType,1).eq(WlRecord::getState,DataStateEnum.ENABLE.getCode());
|
||||||
|
List<WlRecord> wlRecordList = this.list(lambdaQueryWrapper);
|
||||||
|
if(CollUtil.isNotEmpty(wlRecordList)){
|
||||||
|
|
||||||
|
//需要处理的基础数据
|
||||||
|
List<WlRecord> needDealList = wlRecordList.stream().filter(it->Objects.isNull(it.getEndTime())).collect(Collectors.toList());
|
||||||
|
List<String> needIds = needDealList.stream().map(WlRecord::getLineId).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
|
Map<String,List<WlRecord>> lineMap = wlRecordList.stream().collect(Collectors.groupingBy(WlRecord::getLineId));
|
||||||
|
|
||||||
|
List<WlRecord> poList = new ArrayList<>();
|
||||||
|
lineMap.forEach((lineId,list)->{
|
||||||
|
if(needIds.contains(lineId)){
|
||||||
|
//选择起始时间进行倒序
|
||||||
|
list = list.stream().sorted(Comparator.comparing(WlRecord::getStartTime)).collect(Collectors.toList());
|
||||||
|
for(int i=0;i<list.size();i++){
|
||||||
|
LocalDateTime start = list.get(i).getStartTime();
|
||||||
|
String startSql = start.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
if(i==list.size()-1){
|
||||||
|
//判断最迟时间的数据是否没有结束时间
|
||||||
|
if(Objects.isNull(list.get(i).getEndTime())){
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
String sqlNow = now.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper("pqd_data",StatisticalDataDTO.class);
|
||||||
|
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
|
||||||
|
.select(StatisticalDataDTO::getPhaseType)
|
||||||
|
.select(StatisticalDataDTO::getValueType)
|
||||||
|
.last("Pq_Freq")
|
||||||
|
.eq(InfluxDBTableConstant.LINE_ID,lineId)
|
||||||
|
.eq(InfluxDBTableConstant.PHASIC_TYPE,"M")
|
||||||
|
.between(InfluxDBTableConstant.TIME,startSql,sqlNow);
|
||||||
|
System.out.println(influxQueryWrapper.generateSql());
|
||||||
|
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
||||||
|
if(Objects.nonNull(statisticalDataDTO)){
|
||||||
|
LocalDateTime endTime = statisticalDataDTO.getTime().atOffset(ZoneOffset.ofHours(0)).toLocalDateTime();
|
||||||
|
Duration duration = Duration.between(now, endTime);
|
||||||
|
long hour = duration.toHours();
|
||||||
|
if(hour>6){
|
||||||
|
WlRecord wlRecord = new WlRecord();
|
||||||
|
wlRecord.setId(list.get(i).getId());
|
||||||
|
wlRecord.setEndTime(endTime);
|
||||||
|
poList.add(wlRecord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
//如果不存在结束时间,则取后面一条的起始时间作为结束判断标识
|
||||||
|
if(Objects.isNull(list.get(i).getEndTime())){
|
||||||
|
String end = list.get(i+1).getStartTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper("pqd_data",StatisticalDataDTO.class);
|
||||||
|
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
|
||||||
|
.select(StatisticalDataDTO::getPhaseType)
|
||||||
|
.select(StatisticalDataDTO::getValueType)
|
||||||
|
.last("Pq_Freq")
|
||||||
|
.eq(InfluxDBTableConstant.LINE_ID,lineId)
|
||||||
|
.eq(InfluxDBTableConstant.PHASIC_TYPE,"M")
|
||||||
|
.between(InfluxDBTableConstant.TIME,startSql,end);
|
||||||
|
System.out.println(influxQueryWrapper.generateSql());
|
||||||
|
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
||||||
|
WlRecord wlRecord = new WlRecord();
|
||||||
|
wlRecord.setId(list.get(i).getId());
|
||||||
|
|
||||||
|
if(Objects.nonNull(statisticalDataDTO)){
|
||||||
|
LocalDateTime endTime = statisticalDataDTO.getTime().atOffset(ZoneOffset.ofHours(0)).toLocalDateTime();
|
||||||
|
wlRecord.setEndTime(endTime);
|
||||||
|
}else {
|
||||||
|
//TODO 如果查询时间段内无数据,说明装置可能时间段内掉线,出错,需要标识出来
|
||||||
|
wlRecord.setEndTime(list.get(i+1).getStartTime());
|
||||||
|
}
|
||||||
|
poList.add(wlRecord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
if(CollUtil.isNotEmpty(poList)){
|
||||||
|
System.out.println("444");
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据项内的时间进行覆盖:解决多个数据项的startTime及endTime之间存在时间冲突
|
* 数据项内的时间进行覆盖:解决多个数据项的startTime及endTime之间存在时间冲突
|
||||||
* @param data 数据项
|
* @param data 数据项
|
||||||
@@ -538,7 +636,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
if(recordIds.isEmpty()){
|
if(recordIds.isEmpty()){
|
||||||
recordIds.add("-1");
|
recordIds.add("-1");
|
||||||
}
|
}
|
||||||
qw.eq(WlRecord::getState,"1").in(WlRecord::getId,recordIds).orderByAsc(WlRecord::getEndTime);
|
qw.eq(WlRecord::getState,"1").in(WlRecord::getId,recordIds).orderByDesc(WlRecord::getEndTime);
|
||||||
List<WlRecord> list = this.baseMapper.selectList(qw);
|
List<WlRecord> list = this.baseMapper.selectList(qw);
|
||||||
if(list.isEmpty()){
|
if(list.isEmpty()){
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
package com.njcn.csharmonic.constant;
|
package com.njcn.csharmonic.constant;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 常量类
|
* 常量类
|
||||||
* @author qijian
|
* @author qijian
|
||||||
@@ -68,4 +72,13 @@ public interface HarmonicConstant {
|
|||||||
String INSET_DATA = "inset_data";
|
String INSET_DATA = "inset_data";
|
||||||
|
|
||||||
String CTRL_DATA = "ctrl_data";
|
String CTRL_DATA = "ctrl_data";
|
||||||
|
|
||||||
|
|
||||||
|
Set<String> POWER_LIST = new HashSet<>(Arrays.asList(
|
||||||
|
"电网有功功率", "电网无功功率", "电网视在功率", "负载有功功率",
|
||||||
|
"负载无功功率", "负载视在功率", "有功功率", "无功功率",
|
||||||
|
"视在功率", "基波有功功率", "基波无功功率",
|
||||||
|
"基波视在功率", "三相总有功功率", "三相总无功功率",
|
||||||
|
"三相总视在功率"
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,269 +0,0 @@
|
|||||||
//package com.njcn.csharmonic.controller;
|
|
||||||
//
|
|
||||||
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
//import com.njcn.common.pojo.annotation.OperateInfo;
|
|
||||||
//import com.njcn.common.pojo.constant.OperateType;
|
|
||||||
//import com.njcn.common.pojo.enums.common.LogEnum;
|
|
||||||
//import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|
||||||
//import com.njcn.common.pojo.response.HttpResult;
|
|
||||||
//import com.njcn.common.utils.HttpResultUtil;
|
|
||||||
//import com.njcn.harmonic.pojo.param.ReportSearchParam;
|
|
||||||
//import com.njcn.harmonic.pojo.param.ReportTemplateParam;
|
|
||||||
//import com.njcn.harmonic.pojo.po.ExcelRptTemp;
|
|
||||||
//import com.njcn.harmonic.pojo.vo.ReportTemplateVO;
|
|
||||||
//import com.njcn.harmonic.pojo.vo.ReportTreeVO;
|
|
||||||
//import com.njcn.harmonic.pojo.vo.SysDeptTempVO;
|
|
||||||
//import com.njcn.harmonic.service.CustomReportService;
|
|
||||||
//import com.njcn.web.controller.BaseController;
|
|
||||||
//import io.swagger.annotations.Api;
|
|
||||||
//import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
//import io.swagger.annotations.ApiOperation;
|
|
||||||
//import lombok.AllArgsConstructor;
|
|
||||||
//import lombok.extern.slf4j.Slf4j;
|
|
||||||
//import org.springframework.validation.annotation.Validated;
|
|
||||||
//import org.springframework.web.bind.annotation.*;
|
|
||||||
//
|
|
||||||
//import javax.servlet.http.HttpServletResponse;
|
|
||||||
//import java.util.List;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * pqs
|
|
||||||
// * 用户自定义报表
|
|
||||||
// * @author cdf
|
|
||||||
// * @date 2022/8/15
|
|
||||||
// */
|
|
||||||
//
|
|
||||||
//@Slf4j
|
|
||||||
//@RestController
|
|
||||||
//@RequestMapping("/customReport")
|
|
||||||
//@Api(tags = "用户自定义报表")
|
|
||||||
//@AllArgsConstructor
|
|
||||||
//public class CsCustomReportController extends BaseController {
|
|
||||||
//
|
|
||||||
// private final CustomReportService customReportService;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 新增自定义报表模板
|
|
||||||
// * @author cdf
|
|
||||||
// * @date 2022/10/19
|
|
||||||
// */
|
|
||||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType=OperateType.ADD)
|
|
||||||
// @PostMapping("/addTemplate")
|
|
||||||
// @ApiOperation("新增自定义报表模板")
|
|
||||||
// public HttpResult<Boolean> addCustomReportTemplate(@Validated ReportTemplateParam reportTemplateParam){
|
|
||||||
// String methodDescribe = getMethodDescribe("addCustomReportTemplate");
|
|
||||||
// boolean res = customReportService.addCustomReportTemplate(reportTemplateParam);
|
|
||||||
// if(res){
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
|
||||||
// }else {
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 查询所有模板
|
|
||||||
// * @author qijian
|
|
||||||
// * @date 2022/10/14
|
|
||||||
// */
|
|
||||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
// @PostMapping("/getTemplateList")
|
|
||||||
// @ApiOperation("查询报表模板")
|
|
||||||
// @ApiImplicitParam(name = "reportSearchParam", value = "实体参数", required = false)
|
|
||||||
// public HttpResult<List<ReportTemplateVO>> getTemplateList(@RequestBody ReportSearchParam reportSearchParam){
|
|
||||||
// String methodDescribe = getMethodDescribe("getTemplateList");
|
|
||||||
// List<ReportTemplateVO> list = customReportService.getTemplateList(reportSearchParam);
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 根据部门查询模板
|
|
||||||
// * @author qijian
|
|
||||||
// * @date 2022/10/19
|
|
||||||
// */
|
|
||||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
// @GetMapping("/getTemplateByDept")
|
|
||||||
// @ApiOperation("根据部门查询模板")
|
|
||||||
// @ApiImplicitParam(name = "id", value = "id", required = true)
|
|
||||||
// public HttpResult<List<ReportTemplateVO>> getTemplateByDept(@RequestParam("id") String id){
|
|
||||||
// String methodDescribe = getMethodDescribe("getTemplateList");
|
|
||||||
// List<ReportTemplateVO> list = customReportService.getTemplateByDept(id);
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 删除模板
|
|
||||||
// * @author qijian
|
|
||||||
// * @date 2022/10/18
|
|
||||||
// */
|
|
||||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType=OperateType.DELETE)
|
|
||||||
// @PostMapping("/delTemplate")
|
|
||||||
// @ApiOperation("删除报表模板")
|
|
||||||
// @ApiImplicitParam(name = "reportSearchParam", value = "实体参数", required = false)
|
|
||||||
// public HttpResult<Boolean> delTemplate(@RequestBody ReportSearchParam reportSearchParam){
|
|
||||||
// String methodDescribe = getMethodDescribe("delTemplate");
|
|
||||||
// boolean res = customReportService.delTemplate(reportSearchParam);
|
|
||||||
// if(res){
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
|
||||||
// }else {
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 根据id查询模板详情
|
|
||||||
// * @author qijian
|
|
||||||
// * @date 2022/10/14
|
|
||||||
// */
|
|
||||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
// @GetMapping("/getCustomReportTemplateById")
|
|
||||||
// @ApiOperation("根据id查询模板详情")
|
|
||||||
// @ApiImplicitParam(name = "id", value = "id", required = true)
|
|
||||||
// public HttpResult<ExcelRptTemp> getCustomReportTemplateById(@RequestParam("id") String id){
|
|
||||||
// String methodDescribe = getMethodDescribe("getCustomReportTemplateById");
|
|
||||||
// ExcelRptTemp excelRptTemp = customReportService.getCustomReportTemplateById(id);
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, excelRptTemp, methodDescribe);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 根据id回显模板
|
|
||||||
// * @author qijian
|
|
||||||
// * @date 2022/10/14
|
|
||||||
// */
|
|
||||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
// @GetMapping("/viewCustomReportTemplateById")
|
|
||||||
// @ApiOperation("根据id查询模板详情")
|
|
||||||
// @ApiImplicitParam(name = "id", value = "id", required = true)
|
|
||||||
// public void viewCustomReportTemplateById(@RequestParam("id") String id,HttpServletResponse response){
|
|
||||||
// customReportService.viewCustomReportTemplateById(id,response);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 修改自定义报表模板
|
|
||||||
// * @author qijian
|
|
||||||
// * @date 2022/10/18
|
|
||||||
// */
|
|
||||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType=OperateType.UPDATE)
|
|
||||||
// @PostMapping("/updateTemplate")
|
|
||||||
// @ApiOperation("修改自定义报表模板")
|
|
||||||
// public HttpResult<Boolean> updateCustomReportTemplate(@Validated ReportTemplateParam.UpdateReportTemplateParam reportTemplateParam){
|
|
||||||
// String methodDescribe = getMethodDescribe("updateCustomReportTemplate");
|
|
||||||
// boolean res = customReportService.updateCustomReportTemplate(reportTemplateParam);
|
|
||||||
// if(res){
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
|
||||||
// }else {
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 绑定/解绑模板数据
|
|
||||||
// * @author qijian
|
|
||||||
// * @date 2022/10/19
|
|
||||||
// */
|
|
||||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType=OperateType.UPDATE)
|
|
||||||
// @PostMapping("/updateBindTemplate")
|
|
||||||
// @ApiOperation("绑定/解绑模板数据")
|
|
||||||
// @ApiImplicitParam(name = "reportSearchParams", value = "实体参数", required = false)
|
|
||||||
// public HttpResult<Boolean> updateBindTemplate(@RequestBody List<ReportSearchParam> reportSearchParams){
|
|
||||||
// String methodDescribe = getMethodDescribe("updateBindTemplate");
|
|
||||||
// boolean res = customReportService.updateBindTemplate(reportSearchParams);
|
|
||||||
// if(res){
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
|
||||||
// }else {
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 根据模板ID查询数据
|
|
||||||
// * @author qijian
|
|
||||||
// * @date 2022/10/19
|
|
||||||
// */
|
|
||||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
// @GetMapping("/getDataByTempId")
|
|
||||||
// @ApiOperation("根据模板ID查询数据")
|
|
||||||
// @ApiImplicitParam(name = "id", value = "id", required = true)
|
|
||||||
// public HttpResult<List<SysDeptTempVO>> getDataByTempId(@RequestParam("id")String id){
|
|
||||||
// String methodDescribe = getMethodDescribe("getDataByTempId");
|
|
||||||
// List<SysDeptTempVO> list = customReportService.getDataByTempId(id);
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 修改激活状态
|
|
||||||
// * @author qijian
|
|
||||||
// * @date 2022/10/17
|
|
||||||
// */
|
|
||||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType=OperateType.UPDATE)
|
|
||||||
// @PostMapping("/updateTemplateActive")
|
|
||||||
// @ApiOperation("修改激活状态")
|
|
||||||
// @ApiImplicitParam(name = "reportSearchParam", value = "实体参数", required = false)
|
|
||||||
// public HttpResult<Page<ExcelRptTemp>> updateTemplateActive(@RequestBody ReportSearchParam reportSearchParam){
|
|
||||||
// String methodDescribe = getMethodDescribe("updateTemplateActive");
|
|
||||||
// boolean res = customReportService.updateStatus(reportSearchParam);
|
|
||||||
// if(res){
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
|
||||||
// }else {
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 获取报表模板树
|
|
||||||
// * @author cdf
|
|
||||||
// * @date 2022/8/16
|
|
||||||
// */
|
|
||||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
// @GetMapping("/reportChooseTree")
|
|
||||||
// @ApiOperation("获取报表模板树")
|
|
||||||
// public HttpResult<List<ReportTreeVO>> reportChooseTree(){
|
|
||||||
// String methodDescribe = getMethodDescribe("reportChooseTree");
|
|
||||||
// List<ReportTreeVO> res = customReportService.reportChooseTree();
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 替换报表数据并返回
|
|
||||||
// * @author qijian
|
|
||||||
// * @date 2022/10/19
|
|
||||||
// */
|
|
||||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
// @PostMapping("/getCustomReport")
|
|
||||||
// @ApiOperation("获取报表")
|
|
||||||
// @ApiImplicitParam(name = "reportSearchParam", value = "查询体", required = false)
|
|
||||||
// public void getCustomReport(@RequestBody ReportSearchParam reportSearchParam, HttpServletResponse response) {
|
|
||||||
// String methodDescribe = getMethodDescribe("getCustomReport");
|
|
||||||
// customReportService.getCustomReport(reportSearchParam,response);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 获取报表指标是否合格模板树
|
|
||||||
// * @author cdf
|
|
||||||
// * @date 2023/10/11
|
|
||||||
// */
|
|
||||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
// @GetMapping("/targetLimitChooseTree")
|
|
||||||
// @ApiOperation("获取报表指标是否合格模板树")
|
|
||||||
// public HttpResult<List<ReportTreeVO>> targetLimitChooseTree(){
|
|
||||||
// String methodDescribe = getMethodDescribe("targetLimitChooseTree");
|
|
||||||
// List<ReportTreeVO> res = customReportService.targetLimitChooseTree();
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 获取报表台账模板树
|
|
||||||
// * @author cdf
|
|
||||||
// * @date 2023/10/11
|
|
||||||
// */
|
|
||||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
// @GetMapping("/terminalChooseTree")
|
|
||||||
// @ApiOperation("获取报表台账模板树")
|
|
||||||
// public HttpResult<List<ReportTreeVO>> terminalChooseTree(){
|
|
||||||
// String methodDescribe = getMethodDescribe("terminalChooseTree");
|
|
||||||
// List<ReportTreeVO> res = customReportService.terminalChooseTree();
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
@@ -31,6 +31,8 @@ import java.util.Objects;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import static com.njcn.csharmonic.constant.HarmonicConstant.POWER_LIST;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description:
|
* Description:
|
||||||
* Date: 2023/6/26 9:14【需求编号】
|
* Date: 2023/6/26 9:14【需求编号】
|
||||||
@@ -83,13 +85,25 @@ public class DeviceDataTrendServiceImpl implements DeviceDataTrendService {
|
|||||||
//判断监测点类型 针对治理设备 模块数据是一次值、电能质量设备是二次值
|
//判断监测点类型 针对治理设备 模块数据是一次值、电能质量设备是二次值
|
||||||
if (linePo.getClDid() != 0 && Objects.equals(devicDataTrendQueryParam.getDataLevel(),"Primary") && ObjectUtil.isNotNull(epdPqd.getPrimaryFormula())) {
|
if (linePo.getClDid() != 0 && Objects.equals(devicDataTrendQueryParam.getDataLevel(),"Primary") && ObjectUtil.isNotNull(epdPqd.getPrimaryFormula())) {
|
||||||
double secondaryData = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), statisticalDataDTO.getValue(), linePo.getPtRatio(), linePo.getCtRatio());
|
double secondaryData = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), statisticalDataDTO.getValue(), linePo.getPtRatio(), linePo.getCtRatio());
|
||||||
|
if (changePower(epdPqd.getShowName())) {
|
||||||
|
secondaryData = secondaryData/1000;
|
||||||
|
}
|
||||||
vo.setStatisticalData(BigDecimal.valueOf(secondaryData).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
vo.setStatisticalData(BigDecimal.valueOf(secondaryData).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||||
} else {
|
} else {
|
||||||
vo.setStatisticalData(BigDecimal.valueOf(statisticalDataDTO.getValue()).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
Double temVal = statisticalDataDTO.getValue();
|
||||||
|
if (changePower(epdPqd.getShowName())) {
|
||||||
|
temVal = temVal/1000;
|
||||||
|
}
|
||||||
|
vo.setStatisticalData(BigDecimal.valueOf(temVal).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||||
}
|
}
|
||||||
vo.setStatisticalIndex(temp.getDataId());
|
vo.setStatisticalIndex(temp.getDataId());
|
||||||
vo.setStatisticalName(temp.getName());
|
vo.setStatisticalName(temp.getName());
|
||||||
vo.setUnit(temp.getUnit());
|
|
||||||
|
if (changePower(epdPqd.getShowName())) {
|
||||||
|
vo.setUnit("k" + temp.getUnit());
|
||||||
|
} else {
|
||||||
|
vo.setUnit(temp.getUnit());
|
||||||
|
}
|
||||||
vo.setAnotherName(temp.getAnotherName());
|
vo.setAnotherName(temp.getAnotherName());
|
||||||
return vo;
|
return vo;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
@@ -97,4 +111,14 @@ public class DeviceDataTrendServiceImpl implements DeviceDataTrendService {
|
|||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//判断功率是否需要转换
|
||||||
|
public boolean changePower(String name) {
|
||||||
|
return POWER_LIST.stream()
|
||||||
|
.anyMatch(name::contains);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user