From c8f2f0e19e5606f2e8893d1cd3fe759ae2bb7e12 Mon Sep 17 00:00:00 2001 From: psh Date: Fri, 18 Aug 2023 13:17:55 +0800 Subject: [PATCH] fix --- acs/nladmin-system/nlsso-server/pom.xml | 6 - .../acs/address/rest/AddressController.java | 9 +- .../nl/acs/udw/service/UdwManageService.java | 12 ++ .../service/impl/UdwManagerServiceImpl.java | 143 +++++++++++++++++- .../src/views/acs/route/routeLine/index.vue | 2 +- 5 files changed, 159 insertions(+), 13 deletions(-) diff --git a/acs/nladmin-system/nlsso-server/pom.xml b/acs/nladmin-system/nlsso-server/pom.xml index de15d33..0283300 100644 --- a/acs/nladmin-system/nlsso-server/pom.xml +++ b/acs/nladmin-system/nlsso-server/pom.xml @@ -214,7 +214,6 @@ mysql mysql-connector-java - runtime @@ -387,11 +386,6 @@ easyexcel 2.2.6 - - mysql - mysql-connector-java - 8.0.20 - org.json json diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/rest/AddressController.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/rest/AddressController.java index 1b8cd81..25cb1a5 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/rest/AddressController.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/rest/AddressController.java @@ -1,21 +1,20 @@ package org.nl.acs.address.rest; -import org.nl.common.logging.annotation.Log; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.nl.acs.address.service.AddressService; import org.nl.acs.address.service.dto.AddressDto; -import org.nl.acs.address.service.dto.AddressQueryParam; +import org.nl.common.logging.annotation.Log; import org.springframework.data.domain.Pageable; -import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import io.swagger.annotations.*; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Map; -import java.util.Set; /** * @author jiaolm diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/udw/service/UdwManageService.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/udw/service/UdwManageService.java index 034bd3f..6d3ef62 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/udw/service/UdwManageService.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/udw/service/UdwManageService.java @@ -2,8 +2,10 @@ package org.nl.acs.udw.service; import com.alibaba.fastjson.JSONObject; import org.nl.acs.udw.dto.UdwDto; +import org.springframework.data.domain.Pageable; import java.util.List; +import java.util.Map; public interface UdwManageService { /** @@ -13,4 +15,14 @@ public interface UdwManageService { * @return */ List queryByConditions(JSONObject where); + + /** + * 查询数据分页 + * + * @param whereJson 条件 + * @param page 分页参数 + * @return Map + */ + Map queryAll(Map whereJson, Pageable page); + } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/udw/service/impl/UdwManagerServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/udw/service/impl/UdwManagerServiceImpl.java index b5f377c..e03e26f 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/udw/service/impl/UdwManagerServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/udw/service/impl/UdwManagerServiceImpl.java @@ -1,16 +1,157 @@ package org.nl.acs.udw.service.impl; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; +import org.nl.acs.task.service.dto.TaskDto; +import org.nl.acs.udw.UnifiedData; +import org.nl.acs.udw.UnifiedDataAccessorFactory; import org.nl.acs.udw.dto.UdwDto; import org.nl.acs.udw.service.UdwManageService; +import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.Iterator; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; @Service public class UdwManagerServiceImpl implements UdwManageService { + + public UdwManagerServiceImpl() { + } + @Override public List queryByConditions(JSONObject where) { - return null; + String unified_key = null; + String keys = null; + + UnifiedDataUnit unifiedDataUnit = UnifiedDataAccessorFactory.getUnifiedDataAppService().getUnifiedDataUnit(unified_key); + if (unifiedDataUnit == null) { + return null; + } else { + String key; + UdwDto udwDto; + Map storage; + ArrayList udwDtos; + Iterator var14; + if (keys != null) { + storage = unifiedDataUnit.getStorage(); + udwDtos = new ArrayList(); + var14 = storage.keySet().iterator(); + + while(var14.hasNext()) { + key = (String)var14.next(); + if (key.indexOf(keys) != -1) { + udwDto = new UdwDto(); + udwDto.setUnified_key(unified_key); + udwDto.setKey(key); + udwDto.setValue(((UnifiedData)storage.get(key)).getValue()); + udwDtos.add(udwDto); + } + } + + return udwDtos; + } else { + storage = unifiedDataUnit.getStorage(); + udwDtos = new ArrayList(); + var14 = storage.keySet().iterator(); + + while(var14.hasNext()) { + key = (String)var14.next(); + udwDto = new UdwDto(); + udwDto.setUnified_key(unified_key); + udwDto.setKey(key); + udwDto.setValue(((UnifiedData)storage.get(key)).getValue()); + udwDtos.add(udwDto); + } + + return udwDtos; + } + } + } + + @Override + public Map queryAll(Map whereJson, Pageable page) { + + String unified_key = (String) whereJson.get("unified_key"); + String keys = (String) whereJson.get("code"); + if(StrUtil.isEmpty(unified_key)) + { + unified_key = "opc_value"; + } +// String unified_key = (String) whereJson.get("unified_key"); +// String code = (String) whereJson.get("code"); + +// unified_key = whereJson.get("key").toString(); +// keys = whereJson.get("value").toString(); + + + //[[{"column":"unified_key","value":"cached","compareType":"equals","columnType":"object"}]] + UnifiedDataUnit unifiedDataUnit = UnifiedDataAccessorFactory.getUnifiedDataAppService().getUnifiedDataUnit(unified_key); + if (unifiedDataUnit == null) { + return null; + } else { + String key; + UdwDto udwDto; + Map storage; + ArrayList udwDtos; + Iterator var14; + if (keys != null) { + storage = unifiedDataUnit.getStorage(); + udwDtos = new ArrayList(); + var14 = storage.keySet().iterator(); + + while(var14.hasNext()) { + key = (String)var14.next(); + if (key.indexOf(keys) != -1) { + udwDto = new UdwDto(); + udwDto.setUnified_key(unified_key); + udwDto.setKey(key); + udwDto.setValue(((UnifiedData)storage.get(key)).getValue()); + udwDtos.add(udwDto); + } + } + + Integer currentPageNumber = page.getPageNumber() + 1; + Integer pageMaxSize = page.getPageSize(); + + List orderbyDtoList = (List) udwDtos.stream().skip((currentPageNumber - 1) * pageMaxSize) + .limit(pageMaxSize) + .collect(Collectors.toList()); + + JSONObject jo = new JSONObject(); + jo.put("content", orderbyDtoList); + jo.put("totalElements", udwDtos.size()); + + return jo; + } else { + storage = unifiedDataUnit.getStorage(); + udwDtos = new ArrayList(); + var14 = storage.keySet().iterator(); + + while(var14.hasNext()) { + key = (String)var14.next(); + udwDto = new UdwDto(); + udwDto.setUnified_key(unified_key); + udwDto.setKey(key); + udwDto.setValue(((UnifiedData)storage.get(key)).getValue()); + udwDtos.add(udwDto); + } + Integer currentPageNumber = page.getPageNumber() + 1; + Integer pageMaxSize = page.getPageSize(); + + List orderbyDtoList = (List) udwDtos.stream().skip((currentPageNumber - 1) * pageMaxSize) + .limit(pageMaxSize) + .collect(Collectors.toList()); + + JSONObject jo = new JSONObject(); + jo.put("content", orderbyDtoList); + jo.put("totalElements", udwDtos.size()); + + return jo; + } + } } } diff --git a/acs/nladmin-ui/src/views/acs/route/routeLine/index.vue b/acs/nladmin-ui/src/views/acs/route/routeLine/index.vue index 9ac8216..db13c1a 100644 --- a/acs/nladmin-ui/src/views/acs/route/routeLine/index.vue +++ b/acs/nladmin-ui/src/views/acs/route/routeLine/index.vue @@ -156,7 +156,7 @@ v-loading="crud.loading" :data="crud.data" fit="fit" - size="medium" + size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler" >