From 93d7a46e72bcdb6a3d9536c3bf8ea3cb92bfbd5f Mon Sep 17 00:00:00 2001 From: wr <1754607820@qq.com> Date: Wed, 11 Oct 2023 13:33:31 +0800 Subject: [PATCH] =?UTF-8?q?1.=E9=83=A8=E9=97=A8=E7=AD=9B=E9=80=89=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DisPhotovoltaicController.java | 4 +-- .../impl/DisPhotovoltaicServiceImpl.java | 34 +++++++------------ 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/njcn/jbsyncdata/controller/DisPhotovoltaicController.java b/src/main/java/com/njcn/jbsyncdata/controller/DisPhotovoltaicController.java index af30987..98be201 100644 --- a/src/main/java/com/njcn/jbsyncdata/controller/DisPhotovoltaicController.java +++ b/src/main/java/com/njcn/jbsyncdata/controller/DisPhotovoltaicController.java @@ -92,8 +92,8 @@ public class DisPhotovoltaicController { public void import380KV(MultipartFile file, HttpServletResponse response) throws Exception { List list = EasyExcel.read(file.getInputStream()) .head(DisPhotovoltaic380Excel.class) - .headRowNumber(1) - .sheet(0).doReadSync(); + .headRowNumber(2) + .sheet(3).doReadSync(); list = list.stream() .filter(t -> StrUtil.isNotBlank(t.getGenerationUserID())) .filter(t -> StrUtil.isNotBlank(t.getStageID())) diff --git a/src/main/java/com/njcn/jbsyncdata/service/impl/DisPhotovoltaicServiceImpl.java b/src/main/java/com/njcn/jbsyncdata/service/impl/DisPhotovoltaicServiceImpl.java index 84db1a9..961beeb 100644 --- a/src/main/java/com/njcn/jbsyncdata/service/impl/DisPhotovoltaicServiceImpl.java +++ b/src/main/java/com/njcn/jbsyncdata/service/impl/DisPhotovoltaicServiceImpl.java @@ -79,14 +79,7 @@ public class DisPhotovoltaicServiceImpl implements DisPhotovoltaicService { continue; } //todo 变电站未知 - String replace = excel.getCounty().replace("国网冀北", "") - .replace("唐山市","") - .replace("双桥","双桥区") - .replace("古冶","古冶供电中心") - .replace("张家口","国网张家口") - .replace("国网昌黎县供电公司","昌黎县供电公司") - .replace("有限","") - .replace("分",""); + String replace = subString(excel.getCounty()); PmsStatationStat sub = getSub(excel.getPowerSupply() + "_" + replace, oldSubMap); if (ObjectUtil.isNull(sub)) { excel.setErrorMessage("部门信息不存在"); @@ -142,7 +135,7 @@ public class DisPhotovoltaicServiceImpl implements DisPhotovoltaicService { iPmsPowerGenerationUserService.saveOrUpdateBatch(info, 1000); } 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); } 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)); subAddMap.forEach((key, value) -> { String[] split = key.split("_"); - Dept dept = getDeptCode(split[0].replace("国网冀北","") - .replace("唐山市","") - .replace("双桥","双桥区") - .replace("古冶","古冶供电中心") - .replace("张家口","国网张家口") - .replace("国网昌黎县供电公司","昌黎县供电公司") - .replace("有限","") - .replace("分",""), depts); + String replace = subString(split[0]); + Dept dept = getDeptCode(replace, depts); if (ObjectUtil.isNotNull(dept)) { if (!oldNameList.contains(split[1])) { PmsStatationStat stat = new PmsStatationStat(); @@ -334,14 +321,12 @@ public class DisPhotovoltaicServiceImpl implements DisPhotovoltaicService { } } - //10kv变电站添加 + //380kv变电站添加 public void addSub(List list, List dev_voltage) { //查询所有部门 List depts = dictDataMapper.selectUserList(); List statName = list.stream().map(DisPhotovoltaic380Excel::getPowerSupply).distinct().collect(Collectors.toList()); - - List orgName = list.stream().map(x-> subString(x.getCounty())) .distinct().collect(Collectors.toList()); @@ -351,7 +336,6 @@ public class DisPhotovoltaicServiceImpl implements DisPhotovoltaicService { .in(PmsStatationStat::getOrgName, orgName) .eq(PmsStatationStat::getStatus, 1) ); - Map> collect = oldList.stream().collect(Collectors.groupingBy(x -> x.getOrgName() + "_" + x.getPowerName())); Map oldNameMap = oldList.stream().collect(Collectors.toMap(x -> x.getOrgName() + "_" + x.getPowerName(), Function.identity())); List info = new ArrayList(); @@ -402,6 +386,7 @@ public class DisPhotovoltaicServiceImpl implements DisPhotovoltaicService { .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("分",""); }