|
|
|
|
@@ -1,11 +1,418 @@
|
|
|
|
|
package com.njcn.jbsyncdata.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.util.CharsetUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.njcn.jbsyncdata.mapper.DictDataMapper;
|
|
|
|
|
import com.njcn.jbsyncdata.pojo.*;
|
|
|
|
|
import com.njcn.jbsyncdata.service.DisPhotovoltaicService;
|
|
|
|
|
import com.njcn.jbsyncdata.service.IPmsPowerGenerationUserService;
|
|
|
|
|
import com.njcn.jbsyncdata.service.IPmsStatationStatService;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.ServletOutputStream;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.time.ZoneId;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author wr
|
|
|
|
|
* @description
|
|
|
|
|
* @date 2023/9/26 16:10
|
|
|
|
|
*/
|
|
|
|
|
public class DisPhotovoltaicServiceImpl extends DisPhotovoltaicService {
|
|
|
|
|
@Service
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class DisPhotovoltaicServiceImpl implements DisPhotovoltaicService {
|
|
|
|
|
|
|
|
|
|
private final IPmsPowerGenerationUserService iPmsPowerGenerationUserService;
|
|
|
|
|
private final DictDataMapper dictDataMapper;
|
|
|
|
|
private final IPmsStatationStatService iPmsStatationStatService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void SavaPmsPowerGenerationUser10KV(List<DisPhotovoltaic10Excel> list, HttpServletResponse response) {
|
|
|
|
|
List<PmsPowerGenerationUser> info = new ArrayList<>();
|
|
|
|
|
List<DisPhotovoltaic10Excel> errorInfo = new ArrayList<>();
|
|
|
|
|
//电源类别
|
|
|
|
|
DictData powerCategory = dictDataMapper.selectByCode("Distributed_Power", "Power_Category");
|
|
|
|
|
//客户状态
|
|
|
|
|
DictData dictData = dictDataMapper.selectByCode("Normal_Power", "Ecc_Stat");
|
|
|
|
|
//电站类型
|
|
|
|
|
DictData powerStationType = dictDataMapper.selectByCode("Village_Level", "Power_Station_Type");
|
|
|
|
|
//发电方式
|
|
|
|
|
DictData powerGenerationMode = dictDataMapper.selectByCode("Pho_Power", "Power_Generation");
|
|
|
|
|
//消纳方式
|
|
|
|
|
List<DictData> connection_mode = dictDataMapper.selectList("Connection_Mode");
|
|
|
|
|
//电压等级
|
|
|
|
|
List<DictData> dev_voltage = dictDataMapper.selectList("Dev_Voltage");
|
|
|
|
|
//获取部门信息
|
|
|
|
|
List<Dept> depts = dictDataMapper.selectUserList();
|
|
|
|
|
//导入变电站数据
|
|
|
|
|
add(list, dev_voltage);
|
|
|
|
|
PmsPowerGenerationUser user;
|
|
|
|
|
List<PmsStatationStat> oldList = iPmsStatationStatService.list(
|
|
|
|
|
new LambdaQueryWrapper<PmsStatationStat>()
|
|
|
|
|
.eq(PmsStatationStat::getStatus, 1)
|
|
|
|
|
);
|
|
|
|
|
Map<String, PmsStatationStat> oldSubMap = oldList.stream()
|
|
|
|
|
.collect(Collectors.toMap(x -> x.getPowerName() + "_" + x.getOrgName(), Function.identity()));
|
|
|
|
|
|
|
|
|
|
for (DisPhotovoltaic10Excel excel : list) {
|
|
|
|
|
if (StrUtil.hasBlank(excel.getStageID(),
|
|
|
|
|
excel.getLineID()
|
|
|
|
|
)
|
|
|
|
|
) {
|
|
|
|
|
excel.setErrorMessage("线路/台区编号不能为空");
|
|
|
|
|
errorInfo.add(excel);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
//todo 变电站未知
|
|
|
|
|
String replace = excel.getCounty().replace("国网冀北", "")
|
|
|
|
|
.replace("唐山市","")
|
|
|
|
|
.replace("双桥","双桥区")
|
|
|
|
|
.replace("古冶","古冶供电中心")
|
|
|
|
|
.replace("张家口","国网张家口")
|
|
|
|
|
.replace("国网昌黎县供电公司","昌黎县供电公司")
|
|
|
|
|
.replace("有限","")
|
|
|
|
|
.replace("分","");
|
|
|
|
|
PmsStatationStat sub = getSub(excel.getPowerSupply() + "_" + replace, oldSubMap);
|
|
|
|
|
if (ObjectUtil.isNull(sub)) {
|
|
|
|
|
excel.setErrorMessage("部门信息不存在");
|
|
|
|
|
errorInfo.add(excel);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
user = new PmsPowerGenerationUser();
|
|
|
|
|
user.setId(excel.getGenerationUserID());
|
|
|
|
|
user.setName(excel.getGenerationUserName());
|
|
|
|
|
//todo 部门信息
|
|
|
|
|
user.setOrgName("国网" + excel.getOrgName());
|
|
|
|
|
user.setOrgId(getDeptCode("国网" + excel.getOrgName(), depts).getCode());
|
|
|
|
|
user.setOperationName(user.getOrgName());
|
|
|
|
|
user.setOperationId(user.getOrgId());
|
|
|
|
|
//todo 电源类别(分布式电源)
|
|
|
|
|
user.setPowerCategory(powerCategory.getId());
|
|
|
|
|
//todo 电站类型(村级)
|
|
|
|
|
user.setPowerStationType(powerStationType.getId());
|
|
|
|
|
//todo 发电方式未知
|
|
|
|
|
user.setPowerGenerationMode(powerGenerationMode.getId());
|
|
|
|
|
|
|
|
|
|
//todo 电压等级(需要转换)
|
|
|
|
|
user.setVoltageLevel(getVoltage(excel.getVoltage_Level(), dev_voltage));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
user.setSourceCapacity(excel.getContractCapacity());
|
|
|
|
|
|
|
|
|
|
DateTime dateTime = DateUtil.parseDate(excel.getConnectionDate());
|
|
|
|
|
ZoneId zoneId = ZoneId.systemDefault();
|
|
|
|
|
LocalDateTime localDateTime = dateTime.toInstant().atZone(zoneId).toLocalDateTime();
|
|
|
|
|
user.setConnectionDate(localDateTime.toLocalDate());
|
|
|
|
|
|
|
|
|
|
user.setConnectionMode(getAlgoDescribe(excel.getWayConsumption(), connection_mode));
|
|
|
|
|
user.setGcStat(dictData.getId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
user.setPowerStationId(sub.getPowerId());
|
|
|
|
|
user.setLineId(excel.getLineID());
|
|
|
|
|
user.setPlatformId(excel.getStageID());
|
|
|
|
|
user.setUserTag("发电用户");
|
|
|
|
|
user.setIsUpToGrid(1);
|
|
|
|
|
user.setStatus(1);
|
|
|
|
|
user.setCreateTime(LocalDateTime.now());
|
|
|
|
|
user.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
user.setInputStatus(0);
|
|
|
|
|
info.add(user);
|
|
|
|
|
}
|
|
|
|
|
if (CollUtil.isNotEmpty(info)) {
|
|
|
|
|
LambdaQueryWrapper<PmsPowerGenerationUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
lambdaQueryWrapper.eq(PmsPowerGenerationUser::getInputStatus, 0);
|
|
|
|
|
iPmsPowerGenerationUserService.remove(lambdaQueryWrapper);
|
|
|
|
|
iPmsPowerGenerationUserService.saveOrUpdateBatch(info, 1000);
|
|
|
|
|
}
|
|
|
|
|
if (CollUtil.isNotEmpty(errorInfo)) {
|
|
|
|
|
exportExcel(LocalDateTime.now() + "错误信息.xlsx", errorInfo,DisPhotovoltaic10Excel.class, response);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void SavaPmsPowerGenerationUser380KV(List<DisPhotovoltaic380Excel> list, HttpServletResponse response) {
|
|
|
|
|
List<PmsPowerGenerationUser> info = new ArrayList<>();
|
|
|
|
|
List<DisPhotovoltaic380Excel> errorInfo = new ArrayList<>();
|
|
|
|
|
//电源类别
|
|
|
|
|
DictData powerCategory = dictDataMapper.selectByCode("Distributed_Power", "Power_Category");
|
|
|
|
|
//客户状态
|
|
|
|
|
DictData dictData = dictDataMapper.selectByCode("Normal_Power", "Ecc_Stat");
|
|
|
|
|
//电站类型
|
|
|
|
|
DictData powerStationType = dictDataMapper.selectByCode("Village_Level", "Power_Station_Type");
|
|
|
|
|
//发电方式
|
|
|
|
|
DictData powerGenerationMode = dictDataMapper.selectByCode("Pho_Power", "Power_Generation");
|
|
|
|
|
//消纳方式
|
|
|
|
|
List<DictData> connection_mode = dictDataMapper.selectList("Connection_Mode");
|
|
|
|
|
//电压等级
|
|
|
|
|
List<DictData> dev_voltage = dictDataMapper.selectList("Dev_Voltage");
|
|
|
|
|
//获取部门信息
|
|
|
|
|
List<Dept> depts = dictDataMapper.selectUserList();
|
|
|
|
|
//导入变电站数据
|
|
|
|
|
addSub(list, dev_voltage);
|
|
|
|
|
PmsPowerGenerationUser user;
|
|
|
|
|
List<PmsStatationStat> oldList = iPmsStatationStatService.list(
|
|
|
|
|
new LambdaQueryWrapper<PmsStatationStat>()
|
|
|
|
|
.eq(PmsStatationStat::getStatus, 1)
|
|
|
|
|
);
|
|
|
|
|
Map<String, PmsStatationStat> oldSubMap = oldList.stream()
|
|
|
|
|
.collect(Collectors.toMap(x -> x.getPowerName() + "_" + x.getOrgName(), Function.identity()));
|
|
|
|
|
|
|
|
|
|
for (DisPhotovoltaic380Excel excel : list) {
|
|
|
|
|
if (StrUtil.hasBlank(excel.getStageID(),
|
|
|
|
|
excel.getLineID(),
|
|
|
|
|
excel.getConnectionDate()
|
|
|
|
|
)
|
|
|
|
|
) {
|
|
|
|
|
excel.setErrorMessage("并网时间/线路/台区编号不能为空");
|
|
|
|
|
errorInfo.add(excel);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
//todo 变电站未知
|
|
|
|
|
String replace = subString(excel.getCounty());
|
|
|
|
|
|
|
|
|
|
PmsStatationStat sub = getSub(excel.getPowerSupply() + "_" + replace, oldSubMap);
|
|
|
|
|
if (ObjectUtil.isNull(sub)) {
|
|
|
|
|
excel.setErrorMessage("部门信息不存在");
|
|
|
|
|
errorInfo.add(excel);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
user = new PmsPowerGenerationUser();
|
|
|
|
|
user.setId(excel.getGenerationUserID());
|
|
|
|
|
user.setName(excel.getGenerationUserName());
|
|
|
|
|
//todo 部门信息
|
|
|
|
|
user.setOrgName(replace);
|
|
|
|
|
user.setOrgId(getDeptCode(replace, depts).getCode());
|
|
|
|
|
user.setOperationName(user.getOrgName());
|
|
|
|
|
user.setOperationId(user.getOrgId());
|
|
|
|
|
//todo 电源类别(分布式电源)
|
|
|
|
|
user.setPowerCategory(powerCategory.getId());
|
|
|
|
|
//todo 电站类型(村级)
|
|
|
|
|
user.setPowerStationType(powerStationType.getId());
|
|
|
|
|
//todo 发电方式未知
|
|
|
|
|
user.setPowerGenerationMode(powerGenerationMode.getId());
|
|
|
|
|
|
|
|
|
|
//todo 电压等级(需要转换)
|
|
|
|
|
user.setVoltageLevel(get380Voltage(excel.getVoltage_Level(), dev_voltage));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
user.setSourceCapacity(excel.getContractCapacity());
|
|
|
|
|
|
|
|
|
|
DateTime dateTime = DateUtil.parseDate(excel.getConnectionDate());
|
|
|
|
|
ZoneId zoneId = ZoneId.systemDefault();
|
|
|
|
|
LocalDateTime localDateTime = dateTime.toInstant().atZone(zoneId).toLocalDateTime();
|
|
|
|
|
user.setConnectionDate(localDateTime.toLocalDate());
|
|
|
|
|
|
|
|
|
|
user.setConnectionMode(getAlgoDescribe(excel.getWayConsumption(), connection_mode));
|
|
|
|
|
user.setGcStat(dictData.getId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
user.setPowerStationId(sub.getPowerId());
|
|
|
|
|
user.setLineId(excel.getLineID());
|
|
|
|
|
user.setPlatformId(excel.getStageID());
|
|
|
|
|
user.setUserTag("发电用户");
|
|
|
|
|
user.setIsUpToGrid(1);
|
|
|
|
|
user.setStatus(1);
|
|
|
|
|
user.setCreateTime(LocalDateTime.now());
|
|
|
|
|
user.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
user.setInputStatus(1);
|
|
|
|
|
info.add(user);
|
|
|
|
|
}
|
|
|
|
|
if (CollUtil.isNotEmpty(info)) {
|
|
|
|
|
LambdaQueryWrapper<PmsPowerGenerationUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
lambdaQueryWrapper.eq(PmsPowerGenerationUser::getInputStatus, 1);
|
|
|
|
|
iPmsPowerGenerationUserService.remove(lambdaQueryWrapper);
|
|
|
|
|
iPmsPowerGenerationUserService.saveBatch(info, 1000);
|
|
|
|
|
}
|
|
|
|
|
if (CollUtil.isNotEmpty(errorInfo)) {
|
|
|
|
|
exportExcel(LocalDateTime.now() + "错误信息.xlsx", errorInfo,DisPhotovoltaic380Excel.class, response);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getAlgoDescribe(String name, List<DictData> dictData) {
|
|
|
|
|
List<DictData> dictDataList = dictData.stream().filter(x -> x.getName().indexOf(name) != -1).collect(Collectors.toList());
|
|
|
|
|
if (CollUtil.isNotEmpty(dictDataList)) {
|
|
|
|
|
return dictDataList.get(0).getId();
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getVoltage(String name, List<DictData> dictData) {
|
|
|
|
|
List<DictData> dictDataList = dictData.stream().filter(x -> x.getName().indexOf(name) != -1
|
|
|
|
|
&& x.getName().length() == name.length() + 2
|
|
|
|
|
).collect(Collectors.toList());
|
|
|
|
|
if (CollUtil.isNotEmpty(dictDataList)) {
|
|
|
|
|
return dictDataList.get(0).getId();
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String get380Voltage(String name, List<DictData> dictData) {
|
|
|
|
|
List<DictData> dictDataList = dictData.stream().filter(x -> x.getName().equals(name)).collect(Collectors.toList());
|
|
|
|
|
if (CollUtil.isNotEmpty(dictDataList)) {
|
|
|
|
|
return dictDataList.get(0).getId();
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//变电站查询
|
|
|
|
|
public PmsStatationStat getSub(String name, Map<String, PmsStatationStat> oldSubMap) {
|
|
|
|
|
if (oldSubMap.containsKey(name)) {
|
|
|
|
|
return oldSubMap.get(name);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Dept getDeptCode(String name, List<Dept> deptList) {
|
|
|
|
|
List<Dept> collect = deptList.stream().filter(x -> x.getName().equals(name)
|
|
|
|
|
).collect(Collectors.toList());
|
|
|
|
|
if (CollUtil.isNotEmpty(collect)) {
|
|
|
|
|
return collect.get(0);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//10kv变电站添加
|
|
|
|
|
public void add(List<DisPhotovoltaic10Excel> list, List<DictData> dev_voltage) {
|
|
|
|
|
//查询所有部门
|
|
|
|
|
List<Dept> depts = dictDataMapper.selectUserList();
|
|
|
|
|
List<String> statName = list.stream().map(DisPhotovoltaic10Excel::getPowerSupply).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
List<PmsStatationStat> oldList = iPmsStatationStatService.list(
|
|
|
|
|
new LambdaQueryWrapper<PmsStatationStat>()
|
|
|
|
|
.in(PmsStatationStat::getPowerName, statName)
|
|
|
|
|
.eq(PmsStatationStat::getStatus, 1)
|
|
|
|
|
);
|
|
|
|
|
List<String> oldNameList = oldList.stream().map(PmsStatationStat::getPowerName).collect(Collectors.toList());
|
|
|
|
|
List<PmsStatationStat> info = new ArrayList();
|
|
|
|
|
Map<String, DisPhotovoltaic10Excel> subAddMap = list.stream()
|
|
|
|
|
.collect(Collectors.toMap(x -> x.getCounty() + "_" + x.getPowerSupply(), Function.identity(), (key1, key2) -> key2));
|
|
|
|
|
subAddMap.forEach((key, value) -> {
|
|
|
|
|
String[] split = key.split("_");
|
|
|
|
|
Dept dept = getDeptCode(split[0].replace("国网冀北","")
|
|
|
|
|
.replace("唐山市","")
|
|
|
|
|
.replace("双桥","双桥区")
|
|
|
|
|
.replace("古冶","古冶供电中心")
|
|
|
|
|
.replace("张家口","国网张家口")
|
|
|
|
|
.replace("国网昌黎县供电公司","昌黎县供电公司")
|
|
|
|
|
.replace("有限","")
|
|
|
|
|
.replace("分",""), depts);
|
|
|
|
|
if (ObjectUtil.isNotNull(dept)) {
|
|
|
|
|
if (!oldNameList.contains(split[1])) {
|
|
|
|
|
PmsStatationStat stat = new PmsStatationStat();
|
|
|
|
|
stat.setPowerName(split[1]);
|
|
|
|
|
stat.setOrgId(dept.getCode());
|
|
|
|
|
stat.setOrgName(dept.getName());
|
|
|
|
|
stat.setShouldBeNum(100);
|
|
|
|
|
stat.setVoltageLevel(getVoltage(value.getVoltage_Level(), dev_voltage));
|
|
|
|
|
stat.setStatus(1);
|
|
|
|
|
stat.setCreateTime(LocalDateTime.now());
|
|
|
|
|
stat.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
info.add(stat);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (CollUtil.isNotEmpty(info)) {
|
|
|
|
|
iPmsStatationStatService.saveBatch(info, 1000);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//10kv变电站添加
|
|
|
|
|
public void addSub(List<DisPhotovoltaic380Excel> list, List<DictData> dev_voltage) {
|
|
|
|
|
//查询所有部门
|
|
|
|
|
List<Dept> depts = dictDataMapper.selectUserList();
|
|
|
|
|
List<String> statName = list.stream().map(DisPhotovoltaic380Excel::getPowerSupply).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> orgName = list.stream().map(x-> subString(x.getCounty()))
|
|
|
|
|
.distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
List<PmsStatationStat> oldList = iPmsStatationStatService.list(
|
|
|
|
|
new LambdaQueryWrapper<PmsStatationStat>()
|
|
|
|
|
.in(PmsStatationStat::getPowerName, statName)
|
|
|
|
|
.in(PmsStatationStat::getOrgName, orgName)
|
|
|
|
|
.eq(PmsStatationStat::getStatus, 1)
|
|
|
|
|
);
|
|
|
|
|
Map<String, List<PmsStatationStat>> collect = oldList.stream().collect(Collectors.groupingBy(x -> x.getOrgName() + "_" + x.getPowerName()));
|
|
|
|
|
Map<String, PmsStatationStat> oldNameMap = oldList.stream().collect(Collectors.toMap(x -> x.getOrgName() + "_" + x.getPowerName(), Function.identity()));
|
|
|
|
|
|
|
|
|
|
List<PmsStatationStat> info = new ArrayList();
|
|
|
|
|
Map<String, DisPhotovoltaic380Excel> subAddMap = list.stream()
|
|
|
|
|
.collect(Collectors.toMap(x -> x.getCounty() + "_" + x.getPowerSupply(), Function.identity(), (key1, key2) -> key2));
|
|
|
|
|
subAddMap.forEach((key, value) -> {
|
|
|
|
|
String[] split = key.split("_");
|
|
|
|
|
String replace = subString(split[0]);
|
|
|
|
|
Dept dept = getDeptCode(replace, depts);
|
|
|
|
|
if (ObjectUtil.isNotNull(dept)) {
|
|
|
|
|
if (!oldNameMap.containsKey(replace+"_"+split[1])) {
|
|
|
|
|
PmsStatationStat stat = new PmsStatationStat();
|
|
|
|
|
stat.setPowerName(split[1]);
|
|
|
|
|
stat.setOrgId(dept.getCode());
|
|
|
|
|
stat.setOrgName(dept.getName());
|
|
|
|
|
stat.setShouldBeNum(100);
|
|
|
|
|
stat.setVoltageLevel(getVoltage(value.getVoltage_Level(), dev_voltage));
|
|
|
|
|
stat.setStatus(1);
|
|
|
|
|
stat.setCreateTime(LocalDateTime.now());
|
|
|
|
|
stat.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
info.add(stat);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (CollUtil.isNotEmpty(info)) {
|
|
|
|
|
iPmsStatationStatService.saveBatch(info, 1000);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void exportExcel(String fileName, List<?> list,Class<?> t, HttpServletResponse response) {
|
|
|
|
|
try (ServletOutputStream outputStream = response.getOutputStream()) {
|
|
|
|
|
fileName = URLEncoder.encode(fileName, CharsetUtil.UTF_8);
|
|
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
|
|
|
|
|
response.setContentType("application/octet-stream;charset=UTF-8");
|
|
|
|
|
EasyExcel.write(outputStream,t).sheet("sheet").doWrite(list);
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
log.error(">>> 导出数据异常:{}", e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private String subString(String name){
|
|
|
|
|
String replace ;
|
|
|
|
|
if(name.equals("古冶")){
|
|
|
|
|
replace = name
|
|
|
|
|
.replace("古冶","古冶供电中心");
|
|
|
|
|
}else{
|
|
|
|
|
replace = name.replace("国网冀北", "")
|
|
|
|
|
.replace("唐山市","")
|
|
|
|
|
.replace("双桥","双桥区")
|
|
|
|
|
.replace("张家口","国网张家口")
|
|
|
|
|
.replace("国网昌黎县供电公司","昌黎县供电公司")
|
|
|
|
|
.replace("双滦客服中心","双滦区供电中心")
|
|
|
|
|
.replace("营子客服中心","营子区供电中心")
|
|
|
|
|
.replace("安次客户服务分中心","安次供电中心")
|
|
|
|
|
.replace("广阳客户服务分中心","广阳供电中心")
|
|
|
|
|
.replace("国网卢龙县供电公司","卢龙县供电公司")
|
|
|
|
|
.replace("国网青龙县供电公司","青龙县供电公司")
|
|
|
|
|
.replace("广阳客户服务分中心","广阳供电中心")
|
|
|
|
|
.replace("有限","")
|
|
|
|
|
.replace("分","");
|
|
|
|
|
}
|
|
|
|
|
return replace;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|