1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042 |
- package com.bizmatics.service.impl;
- import cn.afterturn.easypoi.excel.ExcelExportUtil;
- import cn.afterturn.easypoi.excel.entity.ExportParams;
- import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
- import com.baomidou.mybatisplus.core.toolkit.Wrappers;
- import com.bizmatics.common.core.exception.BusinessException;
- import com.bizmatics.common.core.util.*;
- import com.bizmatics.common.mvc.base.AbstractCrudService;
- import com.bizmatics.common.spring.util.GlobalUtils;
- import com.bizmatics.model.*;
- import com.bizmatics.persistence.mapper.RtAnalogDataMapper;
- import com.bizmatics.service.DeviceAttributeService;
- import com.bizmatics.service.DeviceService;
- import com.bizmatics.service.RtAnalogDataService;
- import com.bizmatics.service.SiteDynamicPropertiesService;
- import com.bizmatics.service.util.SecurityUtils;
- import com.bizmatics.service.vo.RadCountVO;
- import com.bizmatics.service.vo.RealScoreVO;
- import org.apache.commons.lang3.ArrayUtils;
- import org.apache.poi.ss.usermodel.Workbook;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import java.util.*;
- import java.util.concurrent.atomic.AtomicReference;
- /**
- * <p>
- * 服务实现类
- * </p>
- *
- * @author ya
- * @since 2021-07-07
- */
- @Service
- public class RtAnalogDataServiceImpl extends AbstractCrudService<RtAnalogDataMapper, RtAnalogData> implements RtAnalogDataService {
- @Autowired
- private DeviceService deviceService;
- @Autowired
- private SiteDynamicPropertiesService siteDynamicPropertiesService;
- @Autowired
- private DeviceAttributeService deviceAttributeService;
- @Override
- public RadCountVO selectCount() {
- Integer userId = SecurityUtils.getLoginUser().getUser().getUserId().intValue();
- AtomicReference<Integer> heavyLoad = new AtomicReference<>(0);
- AtomicReference<Integer> easyLoad = new AtomicReference<>(0);
- AtomicReference<Integer> norMalLoad = new AtomicReference<>(0);
- AtomicReference<Integer> count = new AtomicReference<>(0);
- List<Device> deviceList = deviceService.list(userId, null, null, null, null, null);
- List<RtAnalogData> list = baseMapper.list(userId);
- for (Device device : deviceList) {
- list.stream()
- .filter(rtAnalogData -> device.getDeviceCode().equals(rtAnalogData.getDeviceName())).findAny()
- .ifPresent(rtAnalogData -> {
- String installedCapacity = device.getInstalledCapacity();
- double installedCapacityDouble = 0.00;
- if (StringUtils.isNotBlank(installedCapacity)) {
- installedCapacityDouble = Double.parseDouble(installedCapacity);
- if (installedCapacityDouble > 0) {
- installedCapacityDouble = Arith.div(rtAnalogData.getP(), installedCapacityDouble);
- }
- }
- if (installedCapacityDouble < 0.4) {
- easyLoad.getAndSet(easyLoad.get() + 1);
- } else if (installedCapacityDouble >= 0.4 && installedCapacityDouble <= 0.8) {
- norMalLoad.getAndSet(norMalLoad.get() + 1);
- } else {
- heavyLoad.getAndSet(heavyLoad.get() + 1);
- }
- count.getAndSet(count.get() + 1);
- });
- }
- RadCountVO radCountVO = new RadCountVO();
- radCountVO.setHeavyLoad(subRadio(heavyLoad.get(), count.get()));
- radCountVO.setEasyLoad(subRadio(easyLoad.get(), count.get()));
- radCountVO.setNorMalLoad(Arith.sub(1, Arith.add(radCountVO.getEasyLoad(), radCountVO.getHeavyLoad())));
- return radCountVO;
- }
- public Double subRadio(Integer typeCount, Integer count) {
- return Optional.of(count).filter(total -> total != 0).map(sub -> Arith.div(typeCount, sub)).orElse(0.00);
- }
- @Override
- public List<Map<String, Object>> getOne(Integer siteId) {
- List<Map<String, Object>> list = new ArrayList<>();
- Map<String, Object> radMap = baseMapper.getOneMap(siteId);
- Optional.ofNullable(radMap).ifPresent(rad -> {
- for (String name : rad.keySet()) {
- Map<String, Object> map = new HashMap<>();
- map.put("name", name);
- map.put("value", rad.get(name));
- list.add(map);
- }
- });
- return list;
- }
- @Override
- public Double getEpLoad(Integer siteId) {
- Integer userId = SecurityUtils.getLoginUser().getUser().getUserId().intValue();
- return baseMapper.selectTotalLoad(userId, siteId);
- }
- @Override
- public RealScoreVO realScore(String deviceCode) {
- LambdaQueryWrapper<RtAnalogData> queryWrapper = Wrappers.lambdaQuery();
- queryWrapper.eq(RtAnalogData::getDeviceName,deviceCode);
- RtAnalogData rtAnalogData = getOne(queryWrapper);
- Optional.ofNullable(rtAnalogData).orElseThrow(() -> new BusinessException("设备实时信息不存在"));
- //查询设备
- LambdaQueryWrapper<Device> deviceQuery = Wrappers.lambdaQuery();
- deviceQuery.eq(Device::getDeviceCode,deviceCode);
- Device device = deviceService.getOne(deviceQuery);
- Optional.ofNullable(device).orElseThrow(() -> new BusinessException("设备不存在"));
- //查询sd
- LambdaQueryWrapper<SiteDynamicProperties> sdQuery = Wrappers.lambdaQuery();
- sdQuery.eq(SiteDynamicProperties::getSiteId,device.getSiteId());
- SiteDynamicProperties siteDynamicProperties = siteDynamicPropertiesService.getOne(sdQuery);
- Optional.ofNullable(siteDynamicProperties).orElseThrow(() -> new BusinessException("sd不存在"));
- LambdaQueryWrapper<DeviceAttribute> adQuery = Wrappers.lambdaQuery();
- adQuery.eq(DeviceAttribute::getSiteId,device.getSiteId());
- List<DeviceAttribute> deviceAttributes = deviceAttributeService.list(adQuery);
- if (CollectionUtils.isEmpty(deviceAttributes)){
- throw new BusinessException("da不存在");
- }
- DeviceAttribute deviceAttribute = deviceAttributes.stream().min(Comparator.comparing(DeviceAttribute::getId)).get();
- return fillRealScoreData(rtAnalogData,siteDynamicProperties,deviceAttribute);
- }
- /**
- * 填充实时数据
- */
- @Override
- public RealScoreVO fillRealScoreData(RtAnalogData rtAnalogData, SiteDynamicProperties siteDynamicProperties,DeviceAttribute deviceAttribute){
- List<Double> checkList = new ArrayList<>();
- Integer score = 0;
- RealScoreVO realScoreVo = BeanMapperUtils.map(rtAnalogData, RealScoreVO.class);
- if (null == realScoreVo.getCos()){
- realScoreVo.setCos(0.00);
- }
- checkList.add(realScoreVo.getIa());
- checkList.add(realScoreVo.getIb());
- checkList.add(realScoreVo.getIc());
- //电流不平衡
- realScoreVo.setElBalun(checkBalun(checkList));
- checkList.clear();
- checkList.add(realScoreVo.getUa());
- checkList.add(realScoreVo.getUb());
- checkList.add(realScoreVo.getUc());
- //电压不平衡
- realScoreVo.setVtBalun(checkBalun(checkList));
- //电压合格率
- double voltageLevel = Double.parseDouble(siteDynamicProperties.getVoltageLevel());
- realScoreVo.setUaQualified(Arith.sub(rtAnalogData.getUa(), voltageLevel));
- realScoreVo.setUbQualified(Arith.sub(rtAnalogData.getUb(),voltageLevel));
- realScoreVo.setUcQualified(Arith.sub(rtAnalogData.getUc(), voltageLevel));
- //电流负载率
- Double ratedCurrent = deviceAttribute.getRatedCurrent();
- realScoreVo.setIaLoad(Arith.div(realScoreVo.getIa(),ratedCurrent));
- realScoreVo.setIbLoad(Arith.div(realScoreVo.getIb(),ratedCurrent));
- realScoreVo.setIcLoad(Arith.div(realScoreVo.getIc(),ratedCurrent));
- //计算分数
- //电压分数
- realScoreVo.setUaQ(computeUScore(realScoreVo.getUaQualified(), voltageLevel));
- realScoreVo.setUbQ(computeUScore(realScoreVo.getUbQualified(), voltageLevel));
- realScoreVo.setUcQ(computeUScore(realScoreVo.getUcQualified(), voltageLevel));
- if (realScoreVo.getUaQ() && realScoreVo.getUbQ() && realScoreVo.getUcQ()) {
- realScoreVo.setUQ(true);
- score+=20;
- }else {
- realScoreVo.setUQ(false);
- }
- //电流分数
- realScoreVo.setIaLoadQ(realScoreVo.getIaLoad() <= 0.8);
- realScoreVo.setIbLoadQ(realScoreVo.getIbLoad() <= 0.8);
- realScoreVo.setIcLoadQ(realScoreVo.getIcLoad() <= 0.8);
- if (realScoreVo.getIaLoadQ() && realScoreVo.getIbLoadQ() && realScoreVo.getIcLoadQ()){
- realScoreVo.setILoadQ(true);
- score+=20;
- }else {
- realScoreVo.setILoadQ(false);
- }
- //电压平衡分数
- realScoreVo.setElBalunQ(realScoreVo.getElBalun() <= 0.15);
- if (realScoreVo.getElBalunQ()){
- score+=20;
- }
- //电流平衡分数
- realScoreVo.setVtBalunQ(realScoreVo.getVtBalun() <= 0.15);
- if (realScoreVo.getVtBalunQ()){
- score+=20;
- }
- //功率
- realScoreVo.setCosQ(realScoreVo.getCos() <= 0.15);
- if (realScoreVo.getCosQ()){
- score+=20;
- }
- realScoreVo.setScore(score);
- return realScoreVo;
- }
- /**
- * 计算电压分数
- * @return
- */
- public Boolean computeUScore(Double qualified,Double voltageLevel){
- double mul = Arith.mul(qualified, voltageLevel);
- if (mul <= 0.07 && mul >= -0.07){
- return true;
- }
- return false;
- }
- /**
- * 计算电流/电压不平衡
- * @param list
- * @return
- */
- public Double checkBalun(List<Double> list){
- long count = list.stream().filter(code -> 0.00 == code).count();
- if (3 == count){
- return 0.00;
- }
- Double max = list.stream().max(Double::compareTo).get();
- Double min = list.stream().min(Double::compareTo).get();
- return Arith.div(Arith.sub(max,min),max);
- }
- /**
- * 添加数据单位
- *
- * @return
- */
- public String addUnit(String name, String value) {
- if (name.endsWith("电压")) {
- return value + "V";
- } else if (name.endsWith("电流")) {
- return value + "A";
- } else if (name.endsWith("温度")) {
- return value + "C";
- } else if (name.endsWith("频率")) {
- return value + "Hz";
- } else if (name.endsWith("有功功率") || name.endsWith("需量")) {
- return value + "KW";
- } else if (name.endsWith("无功功率")) {
- return value + "KVar";
- } else if (name.endsWith("不平衡度") || name.endsWith("电压畸变率")) {
- return value + "%";
- } else if (name.endsWith("次数")) {
- return value + "次";
- } else if (name.endsWith("电度") || name.endsWith("有功")) {
- return value + "KWh";
- }
- return value;
- }
- @Override
- public List<Map<String, Object>> getDataReport(Integer siteId, Date startTime, Date endTime, String queryType) {
- List<Map<String, Object>> list = new ArrayList<>();
- List<HtAnalogData> rtAnalogDataList = null;
- long diff = endTime.getTime() - startTime.getTime();
- long days = diff / (1000 * 60 * 60);
- if (days <= 24) {
- rtAnalogDataList = baseMapper.getDataReportMap(siteId, startTime, endTime);
- } else if (days < 360 && days > 24) {
- List<Device> device_list = baseMapper.getDeviceListMap(siteId);
- rtAnalogDataList = baseMapper.getDataReportMMap(device_list, startTime, endTime);
- } else if (days >= 360) {
- List<Device> device_list = baseMapper.getDeviceListMap(siteId);
- rtAnalogDataList = baseMapper.getDataReportDMap(device_list, startTime, endTime);
- }
- String[] result = queryType.split(",");
- if (rtAnalogDataList.size() > 0) {
- rtAnalogDataList.forEach(rtAnalogData -> {
- Map<String, Object> map = new HashMap<>();
- if (ArrayUtils.contains(result, "I")) {
- map.put("Ia", rtAnalogData.getIa());
- map.put("Ib", rtAnalogData.getIb());
- map.put("Ic", rtAnalogData.getIc());
- if (ArrayUtils.contains(result, "P")) {
- map.put("P", rtAnalogData.getP());
- map.put("Q", rtAnalogData.getQ());
- map.put("Pa", rtAnalogData.getPa());
- map.put("Pb", rtAnalogData.getPb());
- map.put("Pc", rtAnalogData.getPc());
- map.put("Qa", rtAnalogData.getQa());
- map.put("Qb", rtAnalogData.getQb());
- map.put("Qc", rtAnalogData.getQc());
- map.put("Demand", rtAnalogData.getDemand());
- if (ArrayUtils.contains(result, "KWh")) {
- map.put("Epn", rtAnalogData.getEpn());
- map.put("Epp", rtAnalogData.getEpp());
- map.put("Eqn", rtAnalogData.getEqn());
- map.put("Eqp", rtAnalogData.getEqp());
- if (ArrayUtils.contains(result, "V")) {
- map.put("Ua", rtAnalogData.getUa());
- map.put("Ub", rtAnalogData.getUb());
- map.put("Uc", rtAnalogData.getUc());
- map.put("Uab", rtAnalogData.getUab());
- map.put("Ubc", rtAnalogData.getUbc());
- map.put("Uca", rtAnalogData.getUca());
- map.put("Ul", rtAnalogData.getUl());
- if (ArrayUtils.contains(result, "C")) {
- map.put("T1", rtAnalogData.getT1());
- map.put("T2", rtAnalogData.getT2());
- map.put("T3", rtAnalogData.getT3());
- map.put("T4", rtAnalogData.getT4());
- map.put("DeviceTemp", rtAnalogData.getDeviceTemp());
- if (ArrayUtils.contains(result, "HZ")) {
- map.put("F", rtAnalogData.getF());
- if (ArrayUtils.contains(result, "PS")) {
- map.put("COSa", rtAnalogData.getCOSa());
- map.put("COSb", rtAnalogData.getCOSb());
- map.put("COSc", rtAnalogData.getCOSc());
- map.put("COS", rtAnalogData.getCos());
- if (ArrayUtils.contains(result, "RMS")) {
- map.put("IHa", rtAnalogData.getIHa());
- map.put("IHb", rtAnalogData.getIHb());
- map.put("IHc", rtAnalogData.getIHc());
- if (ArrayUtils.contains(result, "DDB")) {
- map.put("SignalIntensity", rtAnalogData.getSignalIntensity());
- if (ArrayUtils.contains(result, "VT")) {
- map.put("Upt", rtAnalogData.getUpt());
- map.put("Udt", rtAnalogData.getUdt());
- map.put("Ust", rtAnalogData.getUst());
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- if (days <= 24) {
- map.put("dataTime", DateUtils.format(rtAnalogData.getDataTime(), "MM-dd HH:mm"));
- } else if (days < 360 && days > 24) {
- map.put("dataTime", DateUtils.format(rtAnalogData.getDataTime(), "MM-dd HH:mm"));
- } else if (days >= 360) {
- map.put("dataTime", DateUtils.format(rtAnalogData.getDataTime(), DateUtils.PARSE_PATTERNS[8]));
- }
- list.add(map);
- });
- }
- return list;
- }
- @Override
- public List<Map<String, Object>> getHistoricalCurve(Integer siteId, Date startTime, Date endTime, String queryType) {
- List<Map<String, Object>> list = new ArrayList<>();
- List<Map<String, Object>> listdataTime = new ArrayList<>();
- List<Map<String, Object>> list1 = new ArrayList<>();
- List<Map<String, Object>> list2 = new ArrayList<>();
- List<Map<String, Object>> list3 = new ArrayList<>();
- List<Map<String, Object>> list4 = new ArrayList<>();
- List<Map<String, Object>> list5 = new ArrayList<>();
- List<Map<String, Object>> list6 = new ArrayList<>();
- List<Map<String, Object>> list7 = new ArrayList<>();
- List<Map<String, Object>> list8 = new ArrayList<>();
- List<Map<String, Object>> list9 = new ArrayList<>();
- List<HtAnalogData> rtAnalogDataList = null;
- long diff = endTime.getTime() - startTime.getTime();
- long days = diff / (1000 * 60 * 60);
- if (days <= 24) {
- rtAnalogDataList = baseMapper.getDataReportMap(siteId, startTime, endTime);
- } else if (days < 360 && days > 24) {
- List<Device> device_list = baseMapper.getDeviceListMap(siteId);
- rtAnalogDataList = baseMapper.getDataReportMMap(device_list, startTime, endTime);
- } else if (days >= 360) {
- List<Device> device_list = baseMapper.getDeviceListMap(siteId);
- rtAnalogDataList = baseMapper.getDataReportDMap(device_list, startTime, endTime);
- }
- String[] result = queryType.split(",");
- if (rtAnalogDataList.size() > 0) {
- Map<String, Object> mapIe1 = new HashMap<>();
- Map<String, Object> mapIe2 = new HashMap<>();
- Map<String, Object> mapIe3 = new HashMap<>();
- Map<String, Object> mapIe4 = new HashMap<>();
- Map<String, Object> mapIe5 = new HashMap<>();
- Map<String, Object> mapIe6 = new HashMap<>();
- Map<String, Object> mapIe7 = new HashMap<>();
- Map<String, Object> mapIe8 = new HashMap<>();
- Map<String, Object> mapIe9 = new HashMap<>();
- for (int i = 0; i < rtAnalogDataList.size(); i++) {
- Map<String, Object> map = new HashMap<>();
- Map<String, Object> map1 = new HashMap<>();
- Map<String, Object> map2 = new HashMap<>();
- Map<String, Object> map3 = new HashMap<>();
- Map<String, Object> map4 = new HashMap<>();
- Map<String, Object> map5 = new HashMap<>();
- Map<String, Object> map6 = new HashMap<>();
- Map<String, Object> map7 = new HashMap<>();
- Map<String, Object> map8 = new HashMap<>();
- Map<String, Object> map9 = new HashMap<>();
- HtAnalogData rtAnalogData = (HtAnalogData) rtAnalogDataList.get(i);
- // if (days<=24){
- // map.put("dataTime",DateUtils.format(rtAnalogData.getDataTime(),"MM-dd HH:mm"));
- // }else if (days<360&&days>24){
- // map.put("dataTime", DateUtils.format(rtAnalogData.getDataTime(),"MM-dd HH:mm"));
- // }else if (days>=360){
- // map.put("dataTime",DateUtils.format(rtAnalogData.getDataTime(),DateUtils.PARSE_PATTERNS[8]));
- // }
- map.put("dataTime", rtAnalogData.getDataTime());
- if (ArrayUtils.contains(result, "I")) {
- map1.put("Ia", rtAnalogData.getIa());
- map2.put("Ib", rtAnalogData.getIb());
- map3.put("Ic", rtAnalogData.getIc());
- } else if (ArrayUtils.contains(result, "P")) {
- map1.put("P", rtAnalogData.getP());
- map2.put("Q", rtAnalogData.getQ());
- map3.put("Pa", rtAnalogData.getPa());
- map4.put("Pb", rtAnalogData.getPb());
- map5.put("Pc", rtAnalogData.getPc());
- map6.put("Qa", rtAnalogData.getQa());
- map7.put("Qb", rtAnalogData.getQb());
- map8.put("Qc", rtAnalogData.getQc());
- map9.put("Demand", rtAnalogData.getDemand());
- } else if (ArrayUtils.contains(result, "KWh")) {
- map1.put("Epn", rtAnalogData.getEpn());
- map2.put("Epp", rtAnalogData.getEpp());
- map3.put("Eqn", rtAnalogData.getEqn());
- map4.put("Eqp", rtAnalogData.getEqp());
- } else if (ArrayUtils.contains(result, "V")) {
- map1.put("Ua", rtAnalogData.getUa());
- map2.put("Ub", rtAnalogData.getUb());
- map3.put("Uc", rtAnalogData.getUc());
- map4.put("Uab", rtAnalogData.getUab());
- map5.put("Ubc", rtAnalogData.getUbc());
- map6.put("Uca", rtAnalogData.getUca());
- map7.put("Ul", rtAnalogData.getUl());
- } else if (ArrayUtils.contains(result, "C")) {
- map1.put("T1", rtAnalogData.getT1());
- map2.put("T2", rtAnalogData.getT2());
- map3.put("T3", rtAnalogData.getT3());
- map4.put("T4", rtAnalogData.getT4());
- map5.put("DeviceTemp", rtAnalogData.getDeviceTemp());
- } else if (ArrayUtils.contains(result, "HZ")) {
- map1.put("F", rtAnalogData.getF());
- } else if (ArrayUtils.contains(result, "PS")) {
- map1.put("COSa", rtAnalogData.getCOSa());
- map2.put("COSb", rtAnalogData.getCOSb());
- map3.put("COSc", rtAnalogData.getCOSc());
- map4.put("COS", rtAnalogData.getCos());
- } else if (ArrayUtils.contains(result, "RMS")) {
- map1.put("IHa", rtAnalogData.getIHa());
- map2.put("IHb", rtAnalogData.getIHb());
- map3.put("IHc", rtAnalogData.getIHc());
- } else if (ArrayUtils.contains(result, "DDB")) {
- map1.put("SignalIntensity", rtAnalogData.getSignalIntensity());
- } else if (ArrayUtils.contains(result, "VT")) {
- map1.put("Upt", rtAnalogData.getUpt());
- map2.put("Udt", rtAnalogData.getUdt());
- map3.put("Ust", rtAnalogData.getUst());
- }
- listdataTime.add(map);
- list1.add(map1);
- list2.add(map2);
- list3.add(map3);
- list4.add(map4);
- list5.add(map5);
- list6.add(map6);
- list7.add(map7);
- list8.add(map8);
- list9.add(map9);
- }
- Object arre1[][] = new Object[listdataTime.size()][2];
- Object arre2[][] = new Object[listdataTime.size()][2];
- Object arre3[][] = new Object[listdataTime.size()][2];
- Object arre4[][] = new Object[listdataTime.size()][2];
- Object arre5[][] = new Object[listdataTime.size()][2];
- Object arre6[][] = new Object[listdataTime.size()][2];
- Object arre7[][] = new Object[listdataTime.size()][2];
- Object arre8[][] = new Object[listdataTime.size()][2];
- Object arre9[][] = new Object[listdataTime.size()][2];
- if (ArrayUtils.contains(result, "I")) {
- for (int i = 0; i < listdataTime.size(); i++) {
- arre1[i][0] = listdataTime.get(i).get("dataTime");
- arre1[i][1] = list1.get(i).get("Ia");
- arre2[i][0] = listdataTime.get(i).get("dataTime");
- arre2[i][1] = list2.get(i).get("Ib");
- arre3[i][0] = listdataTime.get(i).get("dataTime");
- arre3[i][1] = list3.get(i).get("Ic");
- }
- mapIe1.put("name", "A相电流");
- mapIe1.put("arr", arre1);
- mapIe2.put("name", "B相电流");
- mapIe2.put("arr", arre2);
- mapIe3.put("name", "C相电流");
- mapIe3.put("arr", arre3);
- list.add(mapIe1);
- list.add(mapIe2);
- list.add(mapIe3);
- } else if (ArrayUtils.contains(result, "P")) {
- for (int i = 0; i < listdataTime.size(); i++) {
- arre1[i][0] = listdataTime.get(i).get("dataTime");
- arre1[i][1] = list1.get(i).get("P");
- arre2[i][0] = listdataTime.get(i).get("dataTime");
- arre2[i][1] = list2.get(i).get("Q");
- arre3[i][0] = listdataTime.get(i).get("dataTime");
- arre3[i][1] = list3.get(i).get("Pa");
- arre4[i][0] = listdataTime.get(i).get("dataTime");
- arre4[i][1] = list4.get(i).get("Pb");
- arre5[i][0] = listdataTime.get(i).get("dataTime");
- arre5[i][1] = list5.get(i).get("Pc");
- arre6[i][0] = listdataTime.get(i).get("dataTime");
- arre6[i][1] = list6.get(i).get("Qa");
- arre7[i][0] = listdataTime.get(i).get("dataTime");
- arre7[i][1] = list7.get(i).get("Qb");
- arre8[i][0] = listdataTime.get(i).get("dataTime");
- arre8[i][1] = list8.get(i).get("Qc");
- arre9[i][0] = listdataTime.get(i).get("dataTime");
- arre9[i][1] = list9.get(i).get("Demand");
- }
- mapIe1.put("name", "总有功功率");
- mapIe1.put("arr", arre1);
- mapIe2.put("name", "总无功功率");
- mapIe2.put("arr", arre2);
- mapIe3.put("name", "A相有功功率");
- mapIe3.put("arr", arre3);
- mapIe4.put("name", "B相有功功率");
- mapIe4.put("arr", arre4);
- mapIe5.put("name", "C相有功功率");
- mapIe5.put("arr", arre5);
- mapIe6.put("name", "A相无功功率");
- mapIe6.put("arr", arre6);
- mapIe7.put("name", "B相无功功率");
- mapIe7.put("arr", arre7);
- mapIe8.put("name", "C相无功功率");
- mapIe8.put("arr", arre8);
- mapIe9.put("name", "实时需量");
- mapIe9.put("arr", arre9);
- list.add(mapIe1);
- list.add(mapIe2);
- list.add(mapIe3);
- list.add(mapIe4);
- list.add(mapIe5);
- list.add(mapIe6);
- list.add(mapIe7);
- list.add(mapIe8);
- list.add(mapIe9);
- } else if (ArrayUtils.contains(result, "KWh")) {
- for (int i = 0; i < listdataTime.size(); i++) {
- arre1[i][0] = listdataTime.get(i).get("dataTime");
- arre1[i][1] = list1.get(i).get("Epn");
- arre2[i][0] = listdataTime.get(i).get("dataTime");
- arre2[i][1] = list2.get(i).get("Epp");
- arre3[i][0] = listdataTime.get(i).get("dataTime");
- arre3[i][1] = list3.get(i).get("Eqn");
- arre4[i][0] = listdataTime.get(i).get("dataTime");
- arre4[i][1] = list4.get(i).get("Eqp");
- }
- mapIe1.put("name", "负有功电度");
- mapIe1.put("arr", arre1);
- mapIe2.put("name", "正有功电度");
- mapIe2.put("arr", arre2);
- mapIe3.put("name", "负无功电度");
- mapIe3.put("arr", arre3);
- mapIe4.put("name", "正无功电度");
- mapIe4.put("arr", arre4);
- list.add(mapIe1);
- list.add(mapIe2);
- list.add(mapIe3);
- list.add(mapIe4);
- } else if (ArrayUtils.contains(result, "V")) {
- for (int i = 0; i < listdataTime.size(); i++) {
- arre1[i][0] = listdataTime.get(i).get("dataTime");
- arre1[i][1] = list1.get(i).get("Ua");
- arre2[i][0] = listdataTime.get(i).get("dataTime");
- arre2[i][1] = list2.get(i).get("Ub");
- arre3[i][0] = listdataTime.get(i).get("dataTime");
- arre3[i][1] = list3.get(i).get("Uc");
- arre4[i][0] = listdataTime.get(i).get("dataTime");
- arre4[i][1] = list4.get(i).get("Uab");
- arre5[i][0] = listdataTime.get(i).get("dataTime");
- arre5[i][1] = list5.get(i).get("Ubc");
- arre6[i][0] = listdataTime.get(i).get("dataTime");
- arre6[i][1] = list6.get(i).get("Uca");
- arre7[i][0] = listdataTime.get(i).get("dataTime");
- arre7[i][1] = list7.get(i).get("Ul");
- }
- mapIe1.put("name", "A相电压");
- mapIe1.put("arr", arre1);
- mapIe2.put("name", "B相电压");
- mapIe2.put("arr", arre2);
- mapIe3.put("name", "C相电压");
- mapIe3.put("arr", arre3);
- mapIe4.put("name", "AB线电压");
- mapIe4.put("arr", arre4);
- mapIe5.put("name", "BC线电压");
- mapIe5.put("arr", arre5);
- mapIe6.put("name", "CA线电压");
- mapIe6.put("arr", arre6);
- mapIe7.put("name", "回路电压");
- mapIe7.put("arr", arre7);
- list.add(mapIe1);
- list.add(mapIe2);
- list.add(mapIe3);
- list.add(mapIe4);
- list.add(mapIe5);
- list.add(mapIe6);
- list.add(mapIe7);
- } else if (ArrayUtils.contains(result, "C")) {
- for (int i = 0; i < listdataTime.size(); i++) {
- arre1[i][0] = listdataTime.get(i).get("dataTime");
- arre1[i][1] = list1.get(i).get("T1");
- arre2[i][0] = listdataTime.get(i).get("dataTime");
- arre2[i][1] = list2.get(i).get("T2");
- arre3[i][0] = listdataTime.get(i).get("dataTime");
- arre3[i][1] = list3.get(i).get("T3");
- arre4[i][0] = listdataTime.get(i).get("dataTime");
- arre4[i][1] = list4.get(i).get("T4");
- arre5[i][0] = listdataTime.get(i).get("dataTime");
- arre5[i][1] = list5.get(i).get("DeviceTemp");
- }
- mapIe1.put("name", "外接温度1");
- mapIe1.put("arr", arre1);
- mapIe2.put("name", "外接温度1");
- mapIe2.put("arr", arre2);
- mapIe3.put("name", "外接温度1");
- mapIe3.put("arr", arre3);
- mapIe4.put("name", "外接温度1");
- mapIe4.put("arr", arre4);
- mapIe5.put("name", "环境温度");
- mapIe5.put("arr", arre5);
- list.add(mapIe1);
- list.add(mapIe2);
- list.add(mapIe3);
- list.add(mapIe4);
- list.add(mapIe5);
- } else if (ArrayUtils.contains(result, "HZ")) {
- for (int i = 0; i < listdataTime.size(); i++) {
- arre1[i][0] = listdataTime.get(i).get("dataTime");
- arre1[i][1] = list1.get(i).get("F");
- }
- mapIe1.put("name", "频率");
- mapIe1.put("arr", arre1);
- list.add(mapIe1);
- } else if (ArrayUtils.contains(result, "PS")) {
- for (int i = 0; i < listdataTime.size(); i++) {
- arre1[i][0] = listdataTime.get(i).get("dataTime");
- arre1[i][1] = list1.get(i).get("COSa");
- arre2[i][0] = listdataTime.get(i).get("dataTime");
- arre2[i][1] = list2.get(i).get("COSb");
- arre3[i][0] = listdataTime.get(i).get("dataTime");
- arre3[i][1] = list3.get(i).get("COSc");
- arre4[i][0] = listdataTime.get(i).get("dataTime");
- arre4[i][1] = list4.get(i).get("COS");
- }
- mapIe1.put("name", "A相功率因数");
- mapIe1.put("arr", arre1);
- mapIe2.put("name", "B相功率因数");
- mapIe2.put("arr", arre2);
- mapIe3.put("name", "C相功率因数");
- mapIe3.put("arr", arre3);
- mapIe4.put("name", "功率因数");
- mapIe4.put("arr", arre4);
- list.add(mapIe1);
- list.add(mapIe2);
- list.add(mapIe3);
- list.add(mapIe4);
- } else if (ArrayUtils.contains(result, "RMS")) {
- for (int i = 0; i < listdataTime.size(); i++) {
- arre1[i][0] = listdataTime.get(i).get("dataTime");
- arre1[i][1] = list1.get(i).get("IHa");
- arre2[i][0] = listdataTime.get(i).get("dataTime");
- arre2[i][1] = list2.get(i).get("IHb");
- arre3[i][0] = listdataTime.get(i).get("dataTime");
- arre3[i][1] = list3.get(i).get("IHc");
- }
- mapIe1.put("name", "Ia总谐波电流");
- mapIe1.put("arr", arre1);
- mapIe2.put("name", "Ib总谐波电流");
- mapIe2.put("arr", arre2);
- mapIe3.put("name", "Ic总谐波电流");
- mapIe3.put("arr", arre3);
- list.add(mapIe1);
- list.add(mapIe2);
- list.add(mapIe3);
- } else if (ArrayUtils.contains(result, "DDB")) {
- for (int i = 0; i < listdataTime.size(); i++) {
- arre1[i][0] = listdataTime.get(i).get("dataTime");
- arre1[i][1] = list1.get(i).get("SignalIntensity");
- }
- mapIe1.put("name", "设备信号强度");
- mapIe1.put("arr", arre1);
- list.add(mapIe1);
- } else if (ArrayUtils.contains(result, "VT")) {
- for (int i = 0; i < listdataTime.size(); i++) {
- arre1[i][0] = listdataTime.get(i).get("dataTime");
- arre1[i][1] = list1.get(i).get("Upt");
- arre2[i][0] = listdataTime.get(i).get("dataTime");
- arre2[i][1] = list2.get(i).get("Udt");
- arre3[i][0] = listdataTime.get(i).get("dataTime");
- arre3[i][1] = list3.get(i).get("Ust");
- }
- mapIe1.put("name", "电压暂升次数");
- mapIe1.put("arr", arre1);
- mapIe2.put("name", "电压暂降次数");
- mapIe2.put("arr", arre2);
- mapIe3.put("name", "电压中断次数");
- mapIe3.put("arr", arre3);
- list.add(mapIe1);
- list.add(mapIe2);
- list.add(mapIe3);
- }
- }
- return list;
- }
- @Override
- public String DataReportExport(Integer siteId, Date startTime, Date endTime, String queryType) {
- Integer userId = SecurityUtils.getLoginUser().getUser().getUserId().intValue();
- Workbook workbook = null;
- File file = null;
- long diff = endTime.getTime() - startTime.getTime();
- long days = diff / (1000 * 60 * 60);
- ExportParams params = new ExportParams("数据报表", "数据报表");
- List<HtAnalogData> page1 = null;
- if (days <= 24) {
- page1 = baseMapper.getDataReportMap(siteId, startTime, endTime);
- } else if (days < 360 && days > 24) {
- List<Device> device_list = baseMapper.getDeviceListMap(siteId);
- page1 = baseMapper.getDataReportMMap(device_list, startTime, endTime);
- } else if (days >= 360) {
- List<Device> device_list = baseMapper.getDeviceListMap(siteId);
- page1 = baseMapper.getDataReportDMap(device_list, startTime, endTime);
- }
- String[] result = queryType.split(",");
- try {
- List<ExcelExportEntity> colList = new ArrayList<ExcelExportEntity>();
- ExcelExportEntity colEntity = new ExcelExportEntity("序号", "xh");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("时间", "dataTime");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- if (ArrayUtils.contains(result, "I")) {
- colEntity = new ExcelExportEntity("A相电流", "Ia");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("B相电流", "Ib");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("C相电流", "Ic");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- if (ArrayUtils.contains(result, "P")) {
- colEntity = new ExcelExportEntity("总有功功率", "P");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("总无功功率", "Q");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("A相有功功率", "Pa");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("B相有功功率", "Pb");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("C相有功功率", "Pc");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("A相无功功率", "Qa");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("B相无功功率", "Qb");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("C相无功功率", "Qc");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("实时需量", "Demand");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- if (ArrayUtils.contains(result, "KWh")) {
- colEntity = new ExcelExportEntity("负有功电度", "Epn");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("正有功电度", "Epp");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("负无功电度", "Eqn");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("正无功电度", "Eqp");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- if (ArrayUtils.contains(result, "V")) {
- colEntity = new ExcelExportEntity("A相电压", "Ua");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("B相电压", "Ub");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("C相电压", "Ub");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("AB线电压", "Uab");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("BC线电压", "Ubc");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("CA线电压", "Uca");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("回路电压", "Ul");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- if (ArrayUtils.contains(result, "C")) {
- colEntity = new ExcelExportEntity("外接温度1", "T1");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("外接温度2", "T2");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("外接温度3", "T3");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("外接温度4", "T4");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("环境温度", "DeviceTemp");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- if (ArrayUtils.contains(result, "HZ")) {
- colEntity = new ExcelExportEntity("频率", "F");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- // map.put("F",rtAnalogData.getF());
- if (ArrayUtils.contains(result, "PS")) {
- colEntity = new ExcelExportEntity("A相功率因数", "COSa");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("B相功率因数", "COSb");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("C相功率因数", "COSc");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("功率因数", "COS");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- if (ArrayUtils.contains(result, "RMS")) {
- colEntity = new ExcelExportEntity("Ia总谐波电流", "IHa");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("Ib总谐波电流", "IHb");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("Ic总谐波电流", "IHc");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- if (ArrayUtils.contains(result, "DDB")) {
- colEntity = new ExcelExportEntity("设备信号强度", "SignalIntensity");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- if (ArrayUtils.contains(result, "VT")) {
- colEntity = new ExcelExportEntity("电压暂升次数", "Upt");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("电压暂降次数", "Udt");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- colEntity = new ExcelExportEntity("电压中断次数", "Ust");
- colEntity.setNeedMerge(true);
- colList.add(colEntity);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
- for (int i = 0; i < page1.size(); i++) {
- Map<String, Object> valMap = new HashMap<String, Object>();
- valMap.put("xh", i + 1);
- if (days <= 24) {
- valMap.put("dataTime", DateUtils.format(page1.get(i).getDataTime(), "MM-dd HH:mm"));
- } else if (days < 360 && days > 24) {
- valMap.put("dataTime", DateUtils.format(page1.get(i).getDataTime(), "MM-dd HH:mm"));
- } else if (days >= 360) {
- valMap.put("dataTime", DateUtils.format(page1.get(i).getDataTime(), DateUtils.PARSE_PATTERNS[8]));
- }
- if (ArrayUtils.contains(result, "I")) {
- valMap.put("Ia", page1.get(i).getIa());
- valMap.put("Ib", page1.get(i).getIb());
- valMap.put("Ic", page1.get(i).getIc());
- if (ArrayUtils.contains(result, "P")) {
- valMap.put("P", page1.get(i).getP());
- valMap.put("Q", page1.get(i).getQ());
- valMap.put("Pa", page1.get(i).getPa());
- valMap.put("Pb", page1.get(i).getPb());
- valMap.put("Pc", page1.get(i).getPc());
- valMap.put("Qa", page1.get(i).getQa());
- valMap.put("Qb", page1.get(i).getQb());
- valMap.put("Qc", page1.get(i).getQc());
- valMap.put("Demand", page1.get(i).getDemand());
- if (ArrayUtils.contains(result, "KWh")) {
- valMap.put("Epn", page1.get(i).getEpn());
- valMap.put("Epp", page1.get(i).getEpp());
- valMap.put("Eqn", page1.get(i).getEqn());
- valMap.put("Eqp", page1.get(i).getEqp());
- if (ArrayUtils.contains(result, "V")) {
- valMap.put("Ua", page1.get(i).getUa());
- valMap.put("Ub", page1.get(i).getUb());
- valMap.put("Uc", page1.get(i).getUc());
- valMap.put("Uab", page1.get(i).getUab());
- valMap.put("Ubc", page1.get(i).getUbc());
- valMap.put("Uca", page1.get(i).getUca());
- valMap.put("Ul", page1.get(i).getUl());
- if (ArrayUtils.contains(result, "C")) {
- valMap.put("T1", page1.get(i).getT1());
- valMap.put("T2", page1.get(i).getT2());
- valMap.put("T3", page1.get(i).getT3());
- valMap.put("T4", page1.get(i).getT4());
- valMap.put("DeviceTemp", page1.get(i).getDeviceTemp());
- if (ArrayUtils.contains(result, "HZ")) {
- valMap.put("F", page1.get(i).getF());
- if (ArrayUtils.contains(result, "PS")) {
- valMap.put("COSa", page1.get(i).getCOSa());
- valMap.put("COSb", page1.get(i).getCOSb());
- valMap.put("COSc", page1.get(i).getCOSc());
- valMap.put("COS", page1.get(i).getCos());
- if (ArrayUtils.contains(result, "RMS")) {
- valMap.put("IHa", page1.get(i).getIHa());
- valMap.put("IHb", page1.get(i).getIHb());
- valMap.put("IHc", page1.get(i).getIHc());
- if (ArrayUtils.contains(result, "DDB")) {
- valMap.put("SignalIntensity", page1.get(i).getSignalIntensity());
- if (ArrayUtils.contains(result, "VT")) {
- valMap.put("Upt", page1.get(i).getUpt());
- valMap.put("Udt", page1.get(i).getUdt());
- valMap.put("Ust", page1.get(i).getUst());
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- list.add(valMap);
- }
- workbook = ExcelExportUtil.exportExcel(params, colList, list);
- if (null != workbook) {
- file = FileUtils.getFile(GlobalUtils.getTempBaseDir(), String.format("%s-%s.xlsx", "数据报表", System.currentTimeMillis() + ""));
- FileUtils.createFile(file.getAbsolutePath());
- FileOutputStream allListingFileOutputStream = new FileOutputStream(file);
- workbook.write(allListingFileOutputStream);
- } else {
- throw new BusinessException("表格数据为空");
- }
- } catch (FileNotFoundException e) {
- log.error("导出文件失败", e);
- throw new BusinessException("导出文件失败");
- } catch (IOException e) {
- e.printStackTrace();
- }
- return file.getName();
- }
- // @Override
- // public String DataReportExport(Integer siteId,Date startTime, Date endTime,String queryType){
- // Integer userId = UserUtil.getUserId();
- // Workbook workbook = null;
- // File file = null;
- // long diff = endTime.getTime() - startTime.getTime();
- // long days = diff / (1000 * 60 * 60);
- // try {
- // ExportParams params = new ExportParams(null, "数据报表");
- // workbook = ExcelExportUtil.exportBigExcel(params, HtAnalogDataExportVO.class,
- // (o, i) -> {
- // Page<HtAnalogData> page = new Page<>(i, 30);
- // if (days<=24){
- // page = baseMapper.getDataReportMap1(page,siteId, startTime, endTime);
- // }else if (days<360&&days>24){
- // List<Device> device_list = baseMapper.getDeviceListMap(siteId);
- // page = baseMapper.getDataReportMMap1(page,device_list,startTime, endTime);
- // }else if (days>=360){
- // List<Device> device_list = baseMapper.getDeviceListMap(siteId);
- // page = baseMapper.getDataReportDMap1(page,device_list,startTime, endTime);
- // }
- //
- // return new ArrayList<>(BeanMapperUtils.mapList(page.getRecords(), HtAnalogData.class, HtAnalogDataExportVO.class));
- // },null);
- // if (null != workbook) {
- // file = FileUtils.getFile(GlobalUtils.getTempBaseDir(), String.format("%s-%s.xlsx", "数据报表", System.currentTimeMillis() + ""));
- // FileUtils.createFile(file.getAbsolutePath());
- // FileOutputStream allListingFileOutputStream = new FileOutputStream(file);
- // workbook.write(allListingFileOutputStream);
- // } else {
- // throw new BusinessException("表格数据为空");
- // }
- // } catch (Exception e) {
- // log.error("导出文件失败", e);
- // throw new BusinessException("导出文件失败");
- // } finally {
- // if (workbook != null) {
- // try {
- // workbook.close();
- // } catch (IOException e) {
- // log.error("===export spec=== 关闭workbook失败", e);
- // }
- // }
- // }
- // return file.getName();
- // }
- }
|