From 2ff1e14ce58860cc8d6e0fda7ef2a6797589a02b Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Tue, 2 Apr 2024 16:32:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=99=BA=E8=83=BD=E8=AF=8A?= =?UTF-8?q?=E6=96=AD=E5=88=97=E8=A1=A8=E9=A1=B5=E6=9F=A5=E8=AF=A2=E9=80=9F?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/FdpListTableDataServiceImpl.java | 120 +++++++++++---------- 1 file changed, 64 insertions(+), 56 deletions(-) diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpListTableDataServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpListTableDataServiceImpl.java index 99e77cc..fe2a1e5 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpListTableDataServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpListTableDataServiceImpl.java @@ -38,61 +38,69 @@ import java.util.Map; @RequiredArgsConstructor @Slf4j public class FdpListTableDataServiceImpl implements IFdpListTableDataService { - @Resource - private IStationClient stationClient; - @Value("${url.getNeoFaultPropertyList}") - private String getNeoFaultPropertyList; - @Value("${url.getNeoFaultTableData}") - private String getNeoFaultTableData; - @Override - public R getProperty(String property) { - Map params = new HashMap<>(); - params.put("property",property); - String result = HttpRequestUtil.postCall(params,getNeoFaultPropertyList,"POST"); - if ("STATION".equals(property)){ - List list=new ArrayList<>(); - R> res = JSONObject.parseObject(result, new TypeReference>>() { - }); - if (res.isSuccess()&& CollectionUtil.isNotEmpty(res.getData())){ - for (String s : res.getData()) { - R stationEntityR = stationClient.getStationByCode(s); - if (stationEntityR.isSuccess()&&ObjectUtil.isNotEmpty(stationEntityR.getData())){ - StationEntity station = stationEntityR.getData(); - list.add(station); - } - } - } - return R.data(list); - } - R> res = JSONObject.parseObject(result, new TypeReference>>() { - }); - return res; - } + @Resource + private IStationClient stationClient; + @Value("${url.getNeoFaultPropertyList}") + private String getNeoFaultPropertyList; + @Value("${url.getNeoFaultTableData}") + private String getNeoFaultTableData; - @Override - public R getListByProperty(FDPFaultListInfoDTO req) { - IPage page = new Page<>(); - req.setPageIndex(req.getPageIndex()-1); - page.setSize(req.getPageSize()); - page.setCurrent(req.getPageIndex()+1); - req.setDisplay(1); - req.setIsRoot(0); - req.setOrderBy("NAME"); - req.setOrderKind("desc"); - String result = HttpRequestUtil.postCallObjectParam(req, getNeoFaultTableData, "POST"); - if (StringUtil.isNotBlank(result)) { - R fdpFaultHistoryDataVoR = JSONObject.parseObject(result, new TypeReference>() { - }); - if (!fdpFaultHistoryDataVoR.isSuccess()){ - throw new WebServiceException("请求失败,请紧急联系管理员!!!"); - } - if (fdpFaultHistoryDataVoR.isSuccess()&&ObjectUtil.isNotEmpty(fdpFaultHistoryDataVoR.getData()) - &&ObjectUtil.isNotEmpty(fdpFaultHistoryDataVoR.getData().getList())){ - List list = fdpFaultHistoryDataVoR.getData().getList(); - page.setTotal(fdpFaultHistoryDataVoR.getData().getTotalCount()); - page.setRecords(list); - } - } - return R.data(page); - } + @Override + public R getProperty(String property) { + Map params = new HashMap<>(); + params.put("property", property); + Long startMillis=System.currentTimeMillis(); + String result = HttpRequestUtil.postCall(params, getNeoFaultPropertyList, "POST"); + log.info("fdp查询列表项"+property+"耗时:"+(System.currentTimeMillis()-startMillis)+"ms"); + Long endMillis=System.currentTimeMillis(); + if ("STATION".equals(property)) { + List list = new ArrayList<>(); + R> res = JSONObject.parseObject(result, new TypeReference>>() { + }); + if (res.isSuccess() && CollectionUtil.isNotEmpty(res.getData())) { + R> listAll = stationClient.getListAll(); + if (listAll.isSuccess() && ObjectUtil.isNotEmpty(listAll.getData())) { + for (String s : res.getData()) { + for (StationEntity station : listAll.getData()) { + if (station.getCode().equals(s)) { + list.add(station); + } + } + } + } + } + log.info("fdp查询站点列表项:耗时:"+(System.currentTimeMillis()-endMillis)+"ms"); + return R.data(list); + } + R> res = JSONObject.parseObject(result, new TypeReference>>() { + }); + return res; + } + + @Override + public R getListByProperty(FDPFaultListInfoDTO req) { + IPage page = new Page<>(); + req.setPageIndex(req.getPageIndex() - 1); + page.setSize(req.getPageSize()); + page.setCurrent(req.getPageIndex() + 1); + req.setDisplay(1); + req.setIsRoot(0); + req.setOrderBy("NAME"); + req.setOrderKind("desc"); + String result = HttpRequestUtil.postCallObjectParam(req, getNeoFaultTableData, "POST"); + if (StringUtil.isNotBlank(result)) { + R fdpFaultHistoryDataVoR = JSONObject.parseObject(result, new TypeReference>() { + }); + if (!fdpFaultHistoryDataVoR.isSuccess()) { + throw new WebServiceException("请求失败,请紧急联系管理员!!!"); + } + if (fdpFaultHistoryDataVoR.isSuccess() && ObjectUtil.isNotEmpty(fdpFaultHistoryDataVoR.getData()) + && ObjectUtil.isNotEmpty(fdpFaultHistoryDataVoR.getData().getList())) { + List list = fdpFaultHistoryDataVoR.getData().getList(); + page.setTotal(fdpFaultHistoryDataVoR.getData().getTotalCount()); + page.setRecords(list); + } + } + return R.data(page); + } }