1.部门筛选调整

This commit is contained in:
wr
2023-10-11 13:33:31 +08:00
parent cae7a7f545
commit 93d7a46e72
2 changed files with 14 additions and 24 deletions

View File

@@ -92,8 +92,8 @@ public class DisPhotovoltaicController {
public void import380KV(MultipartFile file, HttpServletResponse response) throws Exception { public void import380KV(MultipartFile file, HttpServletResponse response) throws Exception {
List<DisPhotovoltaic380Excel> list = EasyExcel.read(file.getInputStream()) List<DisPhotovoltaic380Excel> list = EasyExcel.read(file.getInputStream())
.head(DisPhotovoltaic380Excel.class) .head(DisPhotovoltaic380Excel.class)
.headRowNumber(1) .headRowNumber(2)
.sheet(0).doReadSync(); .sheet(3).doReadSync();
list = list.stream() list = list.stream()
.filter(t -> StrUtil.isNotBlank(t.getGenerationUserID())) .filter(t -> StrUtil.isNotBlank(t.getGenerationUserID()))
.filter(t -> StrUtil.isNotBlank(t.getStageID())) .filter(t -> StrUtil.isNotBlank(t.getStageID()))

View File

@@ -79,14 +79,7 @@ public class DisPhotovoltaicServiceImpl implements DisPhotovoltaicService {
continue; continue;
} }
//todo 变电站未知 //todo 变电站未知
String replace = excel.getCounty().replace("国网冀北", "") String replace = subString(excel.getCounty());
.replace("唐山市","")
.replace("双桥","双桥区")
.replace("古冶","古冶供电中心")
.replace("张家口","国网张家口")
.replace("国网昌黎县供电公司","昌黎县供电公司")
.replace("有限","")
.replace("","");
PmsStatationStat sub = getSub(excel.getPowerSupply() + "_" + replace, oldSubMap); PmsStatationStat sub = getSub(excel.getPowerSupply() + "_" + replace, oldSubMap);
if (ObjectUtil.isNull(sub)) { if (ObjectUtil.isNull(sub)) {
excel.setErrorMessage("部门信息不存在"); excel.setErrorMessage("部门信息不存在");
@@ -142,7 +135,7 @@ public class DisPhotovoltaicServiceImpl implements DisPhotovoltaicService {
iPmsPowerGenerationUserService.saveOrUpdateBatch(info, 1000); iPmsPowerGenerationUserService.saveOrUpdateBatch(info, 1000);
} }
if (CollUtil.isNotEmpty(errorInfo)) { if (CollUtil.isNotEmpty(errorInfo)) {
exportExcel(LocalDateTime.now() + "错误信息.xlsx", errorInfo,DisPhotovoltaic10Excel.class, response); exportExcel(DateUtil.now() + "_10kV错误信息.xlsx", errorInfo,DisPhotovoltaic10Excel.class, response);
} }
} }
@@ -242,7 +235,7 @@ public class DisPhotovoltaicServiceImpl implements DisPhotovoltaicService {
iPmsPowerGenerationUserService.saveBatch(info, 1000); iPmsPowerGenerationUserService.saveBatch(info, 1000);
} }
if (CollUtil.isNotEmpty(errorInfo)) { if (CollUtil.isNotEmpty(errorInfo)) {
exportExcel(LocalDateTime.now() + "错误信息.xlsx", errorInfo,DisPhotovoltaic380Excel.class, response); exportExcel(DateUtil.now() + "_380kV错误信息.xlsx", errorInfo,DisPhotovoltaic380Excel.class, response);
} }
} }
@@ -306,14 +299,8 @@ public class DisPhotovoltaicServiceImpl implements DisPhotovoltaicService {
.collect(Collectors.toMap(x -> x.getCounty() + "_" + x.getPowerSupply(), Function.identity(), (key1, key2) -> key2)); .collect(Collectors.toMap(x -> x.getCounty() + "_" + x.getPowerSupply(), Function.identity(), (key1, key2) -> key2));
subAddMap.forEach((key, value) -> { subAddMap.forEach((key, value) -> {
String[] split = key.split("_"); String[] split = key.split("_");
Dept dept = getDeptCode(split[0].replace("国网冀北","") String replace = subString(split[0]);
.replace("唐山市","") Dept dept = getDeptCode(replace, depts);
.replace("双桥","双桥区")
.replace("古冶","古冶供电中心")
.replace("张家口","国网张家口")
.replace("国网昌黎县供电公司","昌黎县供电公司")
.replace("有限","")
.replace("",""), depts);
if (ObjectUtil.isNotNull(dept)) { if (ObjectUtil.isNotNull(dept)) {
if (!oldNameList.contains(split[1])) { if (!oldNameList.contains(split[1])) {
PmsStatationStat stat = new PmsStatationStat(); PmsStatationStat stat = new PmsStatationStat();
@@ -334,14 +321,12 @@ public class DisPhotovoltaicServiceImpl implements DisPhotovoltaicService {
} }
} }
//10kv变电站添加 //380kv变电站添加
public void addSub(List<DisPhotovoltaic380Excel> list, List<DictData> dev_voltage) { public void addSub(List<DisPhotovoltaic380Excel> list, List<DictData> dev_voltage) {
//查询所有部门 //查询所有部门
List<Dept> depts = dictDataMapper.selectUserList(); List<Dept> depts = dictDataMapper.selectUserList();
List<String> statName = list.stream().map(DisPhotovoltaic380Excel::getPowerSupply).distinct().collect(Collectors.toList()); List<String> statName = list.stream().map(DisPhotovoltaic380Excel::getPowerSupply).distinct().collect(Collectors.toList());
List<String> orgName = list.stream().map(x-> subString(x.getCounty())) List<String> orgName = list.stream().map(x-> subString(x.getCounty()))
.distinct().collect(Collectors.toList()); .distinct().collect(Collectors.toList());
@@ -351,7 +336,6 @@ public class DisPhotovoltaicServiceImpl implements DisPhotovoltaicService {
.in(PmsStatationStat::getOrgName, orgName) .in(PmsStatationStat::getOrgName, orgName)
.eq(PmsStatationStat::getStatus, 1) .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())); Map<String, PmsStatationStat> oldNameMap = oldList.stream().collect(Collectors.toMap(x -> x.getOrgName() + "_" + x.getPowerName(), Function.identity()));
List<PmsStatationStat> info = new ArrayList(); List<PmsStatationStat> info = new ArrayList();
@@ -402,6 +386,7 @@ public class DisPhotovoltaicServiceImpl implements DisPhotovoltaicService {
.replace("唐山市","") .replace("唐山市","")
.replace("双桥","双桥区") .replace("双桥","双桥区")
.replace("张家口","国网张家口") .replace("张家口","国网张家口")
.replace("唐山","国网唐山")
.replace("国网昌黎县供电公司","昌黎县供电公司") .replace("国网昌黎县供电公司","昌黎县供电公司")
.replace("双滦客服中心","双滦区供电中心") .replace("双滦客服中心","双滦区供电中心")
.replace("营子客服中心","营子区供电中心") .replace("营子客服中心","营子区供电中心")
@@ -410,6 +395,11 @@ public class DisPhotovoltaicServiceImpl implements DisPhotovoltaicService {
.replace("国网卢龙县供电公司","卢龙县供电公司") .replace("国网卢龙县供电公司","卢龙县供电公司")
.replace("国网青龙县供电公司","青龙县供电公司") .replace("国网青龙县供电公司","青龙县供电公司")
.replace("广阳客户服务分中心","广阳供电中心") .replace("广阳客户服务分中心","广阳供电中心")
.replace("国网秦皇岛市抚宁区供电公司","抚宁县供电公司")
.replace("滦县供电公司","滦南县供电公司")
.replace("下花园客户服务分中心","下花园区供电中心")
.replace("宣化客户服务分中心","宣化区供电中心")
.replace("客户服务中心","供电公司")
.replace("有限","") .replace("有限","")
.replace("",""); .replace("","");
} }