1.代码提交

This commit is contained in:
wr
2023-12-01 08:48:50 +08:00
parent 71ed4ffe12
commit 1129cee5b3
12 changed files with 600 additions and 37 deletions

View File

@@ -5,10 +5,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.EasyExcel;
import com.njcn.jbsyncdata.pojo.DisPhotovoltaic10Excel;
import com.njcn.jbsyncdata.pojo.DisPhotovoltaic380Excel;
import com.njcn.jbsyncdata.pojo.DistributionAreaExcel;
import com.njcn.jbsyncdata.pojo.ZhangDistributionAreaExcel;
import com.njcn.jbsyncdata.pojo.*;
import com.njcn.jbsyncdata.service.DisPhotovoltaicService;
import com.njcn.jbsyncdata.service.IBusinessService;
import com.njcn.jbsyncdata.util.StreamUtil;
@@ -177,6 +174,16 @@ public class DisPhotovoltaicController {
disPhotovoltaicService.SavaZhangArea(list,response);
System.out.println();
}
@ApiOperation(value = "导入通用融合终端模板台区数据", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
@PostMapping("/importDistributionAreaExcel")
public void importDistributionAreaExcel(MultipartFile file, HttpServletResponse response) throws Exception {
List<PowerDistributionAreaExcel.ErrMsg> list = EasyExcel.read(file.getInputStream())
.head(PowerDistributionAreaExcel.ErrMsg.class)
.headRowNumber(2)
.doReadAllSync();
disPhotovoltaicService.importDistributionAreaExcel(list,response);
}
@ApiOperation(value = "将用户数据导入到配网表中")

View File

@@ -22,10 +22,27 @@ public enum MeasTypeEnum {
TOTW("TotW", "有功", "T","data_harmpower_p","p"),
TOTVAR("TotVar", "无功", "T","data_harmpower_q","q");
// A_V3("HphV3_phsA", "A相电压3次谐波值", "A","data_v","v3"),
// B_V3("HphV3_phsB", "A相电压3次谐波值", "B","data_v","v3"),
// C_V3("Hphv3_phsC", "A相电压3次谐波值", "C","data_v","v3");
TOTVAR("TotVar", "无功", "T","data_harmpower_q","q"),
A_V2("HphV2_phsA", "A相电压2次谐波值", "A","data_harmrate_v","v_2"),
B_V2("HphV2_phsB", "B相电压2次谐波值", "B","data_harmrate_v","v_2"),
C_V2("HphV2_phsC", "C相电压2次谐波值", "C","data_harmrate_v","v_2"),
A_V3("HphV3_phsA", "A相电压3次谐波值", "A","data_harmrate_v","v_3"),
B_V3("HphV3_phsB", "B相电压3次谐波值", "B","data_harmrate_v","v_3"),
C_V3("HphV3_phsC", "C相电压3次谐波值", "C","data_harmrate_v","v_3"),
A_V5("HphV5_phsA", "A相电压5次谐波值", "A","data_harmrate_v","v_5"),
B_V5("HphV5_phsB", "B相电压5次谐波值", "B","data_harmrate_v","v_5"),
C_V5("HphV5_phsC", "C相电压5次谐波值", "C","data_harmrate_v","v_5"),
A_V7("HphV7_phsA", "A相电压7次谐波值", "A","data_harmrate_v","v_7"),
B_V7("HphV7_phsB", "B相电压7次谐波值", "B","data_harmrate_v","v_7"),
C_V7("HphV7_phsC", "C相电压7次谐波值", "C","data_harmrate_v","v_7"),
A_V9("HphV9_phsA", "A相电压9次谐波值", "A","data_harmrate_v","v_9"),
B_V9("HphV9_phsB", "B相电压9次谐波值", "B","data_harmrate_v","v_9"),
C_V9("HphV9_phsC", "C相电压9次谐波值", "C","data_harmrate_v","v_9");
//冀北指标名称
private final String measType;

View File

@@ -0,0 +1,16 @@
package com.njcn.jbsyncdata.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.jbsyncdata.pojo.po.PmsGeneratrixWire;
/**
* <p>
* Mapper 接口
* </p>
*
* @author wr
* @since 2023-11-28
*/
public interface PmsGeneratrixWireMapper extends BaseMapper<PmsGeneratrixWire> {
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.jbsyncdata.mapper.PmsGeneratrixWireMapper">
</mapper>

View File

@@ -0,0 +1,182 @@
package com.njcn.jbsyncdata.pojo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.njcn.jbsyncdata.util.ExcelValid;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
* 台区导入模板
* </p>
*
* @author hongawen
* @since 2022-10-14
*/
@Data
public class PowerDistributionAreaExcel implements Serializable {
private static final long serialVersionUID = 1L;
@ColumnWidth(30)
@ExcelProperty(value = "*台区编号")
@ExcelValid(message = "台区编号不能为空")
private String id;
@ColumnWidth(30)
@ExcelProperty(value = "*台区名称")
@ExcelValid(message = "台区名称不能为空")
private String name;
@ColumnWidth(30)
@ExcelProperty(value = "*组织机构名称")
@ExcelValid(message = "组织机构名称不能为空")
private String orgName;
@ColumnWidth(30)
@ExcelProperty(value = "*组织机构ID")
@ExcelValid(message = "组织机构ID不能为空")
private String orgId;
@ColumnWidth(30)
@ExcelProperty(value = "*运维单位名称")
@ExcelValid(message = "运维单位名称不能为空")
private String operationName;
@ColumnWidth(30)
@ExcelProperty(value = "*运维单位ID")
@ExcelValid(message = "运维单位ID不能为空")
private String operationId;
@ColumnWidth(30)
@ExcelProperty(value = "*变电站名称")
@ExcelValid(message = "变电站名称不能为空")
private String powerrName;
@ColumnWidth(30)
@ExcelProperty(value = "*变电站ID")
@ExcelValid(message = "变电站ID不能为空")
private String powerStationId;
@ColumnWidth(30)
@ExcelProperty(value = "*监测线路名称")
@ExcelValid(message = "监测线路名称不能为空")
private String lineName;
@ColumnWidth(30)
@ExcelProperty(value = "*所属线路ID")
@ExcelValid(message = "所属线路ID不能为空")
private String lineId;
@ColumnWidth(30)
@ExcelProperty(value = "*电压等级")
@ExcelValid(message = "电压等级不能为空")
private String voltageLevel;
@ColumnWidth(30)
@ExcelProperty(value = "*配变容量")
@ExcelValid(message = "配变容量不能为空")
private Float pCapacity;
@ColumnWidth(30)
@ExcelProperty(value = "*地区特征")
@ExcelValid(message = "地区特征不能为空")
private String regionalism;
@ColumnWidth(30)
@ExcelProperty(value = "*是否农网")
@ExcelValid(message = "是否农网不能为空")
private String ifRuralPowerGrid;
@ColumnWidth(30)
@ExcelProperty(value = "*使用性质")
@ExcelValid(message = "使用性质不能为空")
private String natureOfUse;
@ColumnWidth(30)
@ExcelProperty(value = "*供电半径")
@ExcelValid(message = "供电半径不能为空")
private Float powerSupplyRadius;
@ColumnWidth(30)
@ExcelProperty(value = "*供电线路总长度")
@ExcelValid(message = "供电线路总长度不能为空")
private Float lineLength;
@ColumnWidth(30)
@ExcelProperty(value = "*运行状态")
@ExcelValid(message = "运行状态不能为空")
private String state;
@ColumnWidth(30)
@ExcelProperty(value = "*分布式光伏用户数")
@ExcelValid(message = "分布式光伏用户数不能为空")
private Integer distributedPhotovoltaicNum;
@ColumnWidth(30)
@ExcelProperty(value = "*分布式光伏总装机容量")
@ExcelValid(message = "分布式光伏总装机容量不能为空")
private Float photovoltaicCapacity;
@ColumnWidth(30)
@ExcelProperty(value = "*是否有电动汽车接入")
@ExcelValid(message = "是否有电动汽车接入不能为空")
private String ifBevAp;
@ColumnWidth(30)
@ExcelProperty(value = "*接入负荷类型")
@ExcelValid(message = "接入负荷类型不能为空")
private String apLoadType;
@ColumnWidth(30)
@ExcelProperty(value = "*是否是上送国网监测点")
@ExcelValid(message = "是否是上送国网监测点不能为空")
private String isUpToGrid;
@ColumnWidth(30)
@ExcelProperty(value = "*PMS资源id")
@ExcelValid(message = "PMS资源id不能为空")
private String pmsId;
@Data
public static class ErrMsg extends PowerDistributionAreaExcel {
@ColumnWidth(60)
@ExcelProperty(value = "错误信息")
private String errMsg;
}
}

View File

@@ -0,0 +1,80 @@
package com.njcn.jbsyncdata.pojo.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import lombok.Getter;
import lombok.Setter;
/**
* <p>
*
* </p>
*
* @author wr
* @since 2023-11-28
*/
@Getter
@Setter
@TableName("pms_generatrix_wire")
public class PmsGeneratrixWire {
private static final long serialVersionUID = 1L;
/**
* 线路id
*/
@TableId("Id")
private String id;
/**
* 线路名称
*/
@TableField("Name")
private String name;
/**
* 电站编号
*/
@TableField("Station_Id")
private String stationId;
/**
* 电站名称
*/
@TableField("Station_Name")
private String stationName;
/**
* 母线名称
*/
@TableField("Generatrix_Name")
private String generatrixName;
/**
* 电压等级
*/
@TableField("Scale")
private String scale;
/**
* 数据状态
*/
@TableField("Status")
private Boolean status;
@TableField("Create_By")
private String createBy;
@TableField("Create_Time")
private LocalDateTime createTime;
@TableField("Update_By")
private String updateBy;
@TableField("Update_Time")
private LocalDateTime updateTime;
}

View File

@@ -1,9 +1,6 @@
package com.njcn.jbsyncdata.service;
import com.njcn.jbsyncdata.pojo.DisPhotovoltaic10Excel;
import com.njcn.jbsyncdata.pojo.DisPhotovoltaic380Excel;
import com.njcn.jbsyncdata.pojo.DistributionAreaExcel;
import com.njcn.jbsyncdata.pojo.ZhangDistributionAreaExcel;
import com.njcn.jbsyncdata.pojo.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@@ -65,4 +62,9 @@ public interface DisPhotovoltaicService {
* @Date: 2023/10/11 14:31
*/
Boolean savePmsDistributionArea();
/**
* 批量导入台区台账数据
*/
void importDistributionAreaExcel(List<PowerDistributionAreaExcel.ErrMsg> list, HttpServletResponse response);
}

View File

@@ -0,0 +1,16 @@
package com.njcn.jbsyncdata.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.jbsyncdata.pojo.po.PmsGeneratrixWire;
/**
* <p>
* 服务类
* </p>
*
* @author wr
* @since 2023-11-28
*/
public interface IPmsGeneratrixWireService extends IService<PmsGeneratrixWire> {
}

View File

@@ -3,6 +3,7 @@ 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.date.LocalDateTimeUtil;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
@@ -11,13 +12,13 @@ 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.pojo.po.PmsGeneratrixWire;
import com.njcn.jbsyncdata.pojo.po.PmsPowerDistributionarea;
import com.njcn.jbsyncdata.service.DisPhotovoltaicService;
import com.njcn.jbsyncdata.service.IPmsPowerDistributionareaService;
import com.njcn.jbsyncdata.service.IPmsPowerGenerationUserService;
import com.njcn.jbsyncdata.service.IPmsStatationStatService;
import com.njcn.jbsyncdata.service.*;
import com.njcn.jbsyncdata.util.ExcelValid;
import com.njcn.jbsyncdata.util.StreamUtil;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.time.ZoneId;
@@ -27,6 +28,7 @@ import java.util.stream.Collectors;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -46,7 +48,7 @@ public class DisPhotovoltaicServiceImpl implements DisPhotovoltaicService {
private final DictDataMapper dictDataMapper;
private final IPmsStatationStatService iPmsStatationStatService;
private final IPmsPowerDistributionareaService powerDistributionareaService;
private final IPmsGeneratrixWireService generatrixWireService;
@Override
public void SavaPmsPowerGenerationUser10KV(List<DisPhotovoltaic10Excel> list, HttpServletResponse response) {
List<PmsPowerGenerationUser> info = new ArrayList<>();
@@ -453,6 +455,165 @@ public class DisPhotovoltaicServiceImpl implements DisPhotovoltaicService {
return dictDataMapper.insertPmsDistributionArea(dictData.getId());
}
@Override
public void importDistributionAreaExcel(List<PowerDistributionAreaExcel.ErrMsg> list, HttpServletResponse response) {
List<PmsPowerDistributionarea> info=new ArrayList<>();
List<PowerDistributionAreaExcel.ErrMsg> errInfo=new ArrayList<>();
if(CollUtil.isNotEmpty(list)){
PmsPowerDistributionarea area;
//获取部门信息
List<Dept> depts = dictDataMapper.selectUserList();
//电压等级
List<DictData> devVoltage = dictDataMapper.selectList("Dev_Voltage");
//地区特征
List<DictData> deviceRegionLype = dictDataMapper.selectList("Area");
//使用性质
List<DictData> deviceUseNature = dictDataMapper.selectList("Device_UseNature");
//运行状态
List<DictData> lineState = dictDataMapper.selectList("Line_State ");
for (PowerDistributionAreaExcel.ErrMsg msg : list) {
String objNull = isObjNull(msg);
if(StrUtil.isNotBlank(objNull)){
msg.setErrMsg(objNull);
errInfo.add(msg);
continue;
}
area=new PmsPowerDistributionarea();
area.setId(msg.getId());
area.setName(msg.getName());
List<Dept> deptList = depts.stream().filter(x -> x.getCode().contains(msg.getOrgId())).collect(Collectors.toList());
if(CollUtil.isEmpty(deptList)){
String org = subString(msg.getOrgName().replace("国网",""));
List<Dept> deptName = depts.stream().filter(x -> x.getName().contains(org)).collect(Collectors.toList());
if(CollUtil.isNotEmpty(deptName)){
area.setOrgName(deptName.get(0).getName());
area.setOrgId(deptName.get(0).getCode());
}else{
msg.setErrMsg("组织机构不存在");
errInfo.add(msg);
continue;
}
}else{
area.setOrgName(deptList.get(0).getName());
area.setOrgId(deptList.get(0).getCode());
}
area.setOperationName(msg.getOperationName());
area.setOperationId(msg.getOperationId());
area.setPowerrName(msg.getPowerrName());
area.setPowerStationId(msg.getPowerStationId());
area.setLineName(msg.getLineName());
area.setLineId(msg.getLineId());
area.setVoltageLevel(getAlgoDescribe(msg.getVoltageLevel(),devVoltage));
area.setPCapacity(msg.getPCapacity());
area.setRegionalism(getAlgoDescribe(msg.getRegionalism(),deviceRegionLype));
area.setIfRuralPowerGrid("".equals(msg.getIfRuralPowerGrid())?true:false);
area.setNatureOfUse(getAlgoDescribe(msg.getNatureOfUse(),deviceUseNature));
area.setPowerSupplyRadius(msg.getPowerSupplyRadius());
area.setLineLength(msg.getLineLength());
area.setState(getAlgoDescribe(msg.getState(),lineState));
area.setDistributedPhotovoltaicNum(msg.getDistributedPhotovoltaicNum());
area.setPhotovoltaicCapacity(msg.getPhotovoltaicCapacity());
area.setIfBevAp("".equals(msg.getIfBevAp())?true:false);
area.setApLoadType(msg.getApLoadType());
area.setIsUpToGrid("".equals(msg.getIfBevAp())?true:false);
area.setStatus(true);
area.setInputStatus(0);
area.setCreateTime(LocalDateTimeUtil.now());
area.setUpdateTime(LocalDateTimeUtil.now());
area.setPmsID(msg.getPmsId());
info.add(area);
}
if(CollUtil.isNotEmpty(info)){
info = info.stream().collect(Collectors.collectingAndThen
(Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(o -> o.getId()))), ArrayList::new));
List<String> ids = info.stream().map(PmsPowerDistributionarea::getId).collect(Collectors.toList());
List<PowerDistributionAreaExcel.ErrMsg> subInfo = list.stream().filter(x -> ids.contains(x.getId())).collect(Collectors.toList());
addSubWire(subInfo,devVoltage);
powerDistributionareaService.remove(new LambdaQueryWrapper<PmsPowerDistributionarea>()
.in(PmsPowerDistributionarea::getId, ids)
);
powerDistributionareaService.saveBatch(info, 1000);
}
if (CollUtil.isNotEmpty(errInfo)) {
exportExcel(DateUtil.now() + "_台区台账错误信息.xlsx", errInfo,PowerDistributionAreaExcel.ErrMsg.class, response);
}
}
}
//变电站和线路插入
public void addSubWire(List<PowerDistributionAreaExcel.ErrMsg> info,List<DictData> devVoltage) {
List<PmsStatationStat> stats=new ArrayList<>();
PmsStatationStat stat;
List<PmsGeneratrixWire> wires=new ArrayList<>();
PmsGeneratrixWire wire;
List<PmsStatationStat> oldStat = iPmsStatationStatService.list();
List<String> statIds = oldStat.stream().map(PmsStatationStat::getPowerId).distinct().collect(Collectors.toList());
List<PmsGeneratrixWire> oldWire = generatrixWireService.list();
List<String> wireIds = oldWire.stream().map(x-> x.getId()+"_"+x.getStationId()).distinct().collect(Collectors.toList());
//变电站集合
ArrayList<PowerDistributionAreaExcel.ErrMsg> statList = info.stream().collect(Collectors.collectingAndThen
(Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(o -> o.getPowerStationId()))), ArrayList::new));
for (PowerDistributionAreaExcel.ErrMsg errMsg : statList) {
if(!statIds.contains(errMsg.getPowerStationId())){
stat=new PmsStatationStat();
stat.setPowerId(errMsg.getPowerStationId());
stat.setPowerName(errMsg.getPowerrName());
stat.setOrgId(errMsg.getOrgId());
stat.setOrgName(errMsg.getOrgName());
stat.setShouldBeNum(100);
stat.setVoltageLevel(getAlgoDescribe(errMsg.getVoltageLevel(),devVoltage));
stat.setStatus(1);
stat.setCreateTime(LocalDateTimeUtil.now());
stat.setUpdateTime(LocalDateTimeUtil.now());
stats.add(stat);
}
}
//线路
ArrayList<PowerDistributionAreaExcel.ErrMsg> wireList = info.stream().collect(Collectors.collectingAndThen
(Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(o -> o.getLineId()+";"+o.getPowerStationId()))), ArrayList::new));
for (PowerDistributionAreaExcel.ErrMsg errMsg : wireList){
if(!wireIds.contains(errMsg.getLineId()+"_"+errMsg.getPowerStationId())){
wire=new PmsGeneratrixWire();
wire.setId(errMsg.getLineId());
wire.setName(errMsg.getLineName());
wire.setStationId(errMsg.getPowerStationId());
wire.setStationName(errMsg.getPowerrName());
wire.setGeneratrixName(errMsg.getPowerrName());
wire.setScale(getAlgoDescribe(errMsg.getVoltageLevel(),devVoltage));
wire.setStatus(true);
wire.setCreateTime(LocalDateTimeUtil.now());
wire.setUpdateTime(LocalDateTimeUtil.now());
wires.add(wire);
}
}
if(CollUtil.isNotEmpty(stats)){
iPmsStatationStatService.saveBatch(stats);
}
if(CollUtil.isNotEmpty(wires)){
generatrixWireService.saveBatch(wires);
}
}
@SneakyThrows
public String isObjNull(Object object) {
Field[] fields = object.getClass().getSuperclass().getDeclaredFields();
StringBuilder builder = new StringBuilder();
for (Field field : fields) {
//设置可访问
field.setAccessible(true);
//属性的值
Object fieldValue = field.get(object);
//是否包含必填校验注解
boolean isExcelValid = field.isAnnotationPresent(ExcelValid.class);
if (isExcelValid && Objects.isNull(fieldValue)) {
builder.append(field.getAnnotation(ExcelValid.class).message() + "; ");
}
}
return builder.toString();
}
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)) {

View File

@@ -0,0 +1,20 @@
package com.njcn.jbsyncdata.service.impl;
import com.njcn.jbsyncdata.mapper.PmsGeneratrixWireMapper;
import com.njcn.jbsyncdata.pojo.po.PmsGeneratrixWire;
import com.njcn.jbsyncdata.service.IPmsGeneratrixWireService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author wr
* @since 2023-11-28
*/
@Service
public class PmsGeneratrixWireServiceImpl extends ServiceImpl<PmsGeneratrixWireMapper, PmsGeneratrixWire> implements IPmsGeneratrixWireService {
}

View File

@@ -0,0 +1,16 @@
package com.njcn.jbsyncdata.util;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* <p>Excel导入必填校验注解</p>
*
*/
@Target({ ElementType.FIELD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface ExcelValid {
String message() default "导入有未填入的字段";
}

View File

@@ -567,11 +567,11 @@ public class PubUtils {
.head(ZhangDistributionAreaExcel.class)
.doReadAllSync();
listZhang = listZhang.stream()
.filter(t -> StrUtil.isNotBlank(t.getId()))
.filter(StreamUtil.distinctByKey(ZhangDistributionAreaExcel::getId))
.filter(t -> !"#N/A".equals(t.getPmsID()))
.filter(t -> StrUtil.isNotBlank(t.getPmsID()))
.collect(Collectors.toList());
.filter(t -> StrUtil.isNotBlank(t.getId()))
.filter(StreamUtil.distinctByKey(ZhangDistributionAreaExcel::getId))
.filter(t -> !"#N/A".equals(t.getPmsID()))
.filter(t -> StrUtil.isNotBlank(t.getPmsID()))
.collect(Collectors.toList());
//读取所有没数据的用户号
FileReader fileReader = new FileReader("D:\\test\\all.txt");
@@ -609,7 +609,23 @@ public class PubUtils {
.replaceAll("PhV_phsB", "B相电压")
.replaceAll("PhV_phsC", "C相电压")
.replaceAll("TotW", "有功")
.replaceAll("TotVar", "无功");
.replaceAll("TotVar", "无功")
.replaceAll("HphV2_phsA", "A相电压2次谐波值")
.replaceAll("HphV2_phsB", "B相电压2次谐波值")
.replaceAll("HphV2_phsC", "C相电压2次谐波值")
.replaceAll("HphV3_phsA", "A相电压3次谐波值")
.replaceAll("HphV3_phsB", "B相电压3次谐波值")
.replaceAll("HphV3_phsC", "C相电压3次谐波值")
.replaceAll("HphV5_phsA", "A相电压5次谐波值")
.replaceAll("HphV5_phsB", "B相电压5次谐波值")
.replaceAll("HphV7_phsC", "C相电压7次谐波值")
.replaceAll("HphV7_phsA", "A相电压7次谐波值")
.replaceAll("HphV7_phsB", "B相电压7次谐波值")
.replaceAll("HphV5_phsC", "C相电压5次谐波值")
.replaceAll("HphV9_phsA", "A相电压9次谐波值")
.replaceAll("HphV9_phsB", "B相电压9次谐波值")
.replaceAll("HphV9_phsC", "C相电压9次谐波值")
;
disPhotovoltaic10Excel.setTypes(info);
final10kVUserData.add(disPhotovoltaic10Excel);
}
@@ -633,22 +649,47 @@ public class PubUtils {
for (String userId : keyedSet) {
disPhotovoltaic380ExcelList = all380VMap.get(userId);
if (CollectionUtil.isNotEmpty(disPhotovoltaic380ExcelList)) {
disPhotovoltaic380Excel = disPhotovoltaic380ExcelList.get(0);
info = noPartDataMap.get(userId).get(0);
info = info.substring(info.indexOf(StrPool.COMMA) + 1);
info = info.replaceAll(StrPool.AT, "||")
.replaceAll("A_phsA", "A相电流")
.replaceAll("A_phsB", "B相电流")
.replaceAll("A_phsC", "C相电流")
.replaceAll("PhV_phsA", "A相电")
.replaceAll("PhV_phsB", "B相电")
.replaceAll("PhV_phsC", "C相电压")
.replaceAll("TotW", "有功")
.replaceAll("TotVar", "无功");
disPhotovoltaic380Excel.setTypes(info);
final380VUserData.add(disPhotovoltaic380Excel);
List<ZhangDistributionAreaExcel> collect1 = disPhotovoltaic380ExcelList.stream().distinct().collect(Collectors.toList());
for (ZhangDistributionAreaExcel zhangDistributionAreaExcel : collect1) {
disPhotovoltaic380Excel=zhangDistributionAreaExcel;
info = zhangDistributionAreaExcel.getPmsID();
info = info.substring(info.indexOf(StrPool.COMMA) + 1);
info = info.replaceAll(StrPool.AT, "||")
.replaceAll("A_phsA", "A相电流")
.replaceAll("A_phsB", "B相电")
.replaceAll("A_phsC", "C相电")
.replaceAll("PhV_phsA", "A相电压")
.replaceAll("PhV_phsB", "B相电压")
.replaceAll("PhV_phsC", "C相电压")
.replaceAll("TotW", "有功")
.replaceAll("TotVar", "无功")
.replaceAll("HphV2_phsA", "A相电压2次谐波值")
.replaceAll("HphV2_phsB", "B相电压2次谐波值")
.replaceAll("HphV2_phsC", "C相电压2次谐波值")
.replaceAll("HphV3_phsA", "A相电压3次谐波值")
.replaceAll("HphV3_phsB", "B相电压3次谐波值")
.replaceAll("HphV3_phsC", "C相电压3次谐波值")
.replaceAll("HphV5_phsA", "A相电压5次谐波值")
.replaceAll("HphV5_phsB", "B相电压5次谐波值")
.replaceAll("HphV7_phsC", "C相电压7次谐波值")
.replaceAll("HphV7_phsA", "A相电压7次谐波值")
.replaceAll("HphV7_phsB", "B相电压7次谐波值")
.replaceAll("HphV5_phsC", "C相电压5次谐波值")
.replaceAll("HphV9_phsA", "A相电压9次谐波值")
.replaceAll("HphV9_phsB", "B相电压9次谐波值")
.replaceAll("HphV9_phsC", "C相电压9次谐波值")
;
disPhotovoltaic380Excel.setTypes(info);
final380VUserData.add(disPhotovoltaic380Excel);
}
}
}
List<String> collect1 = final380VUserData.stream().map(ZhangDistributionAreaExcel::getId).collect(Collectors.toList());
List<String> collect2 = collect4.stream().map(ZhangDistributionAreaExcel::getId).collect(Collectors.toList());
listZhang= listZhang.stream().filter(t -> !collect1.contains(t.getId())).collect(Collectors.toList());
listZhang= listZhang.stream().filter(t -> !collect2.contains(t.getId())).collect(Collectors.toList());
EasyExcel.write("D:\\test\\张家口部分没有数据的.xlsx", ZhangDistributionAreaExcel.class).sheet("张家口部分没有数据的").doWrite(final380VUserData);
long millis4 = System.currentTimeMillis();
System.out.println("张家口部分没有数据的:" + (millis4 - millis3));