fix
This commit is contained in:
@@ -214,7 +214,6 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- druid数据源驱动 -->
|
<!-- druid数据源驱动 -->
|
||||||
@@ -387,11 +386,6 @@
|
|||||||
<artifactId>easyexcel</artifactId>
|
<artifactId>easyexcel</artifactId>
|
||||||
<version>2.2.6</version>
|
<version>2.2.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
|
||||||
<version>8.0.20</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.json</groupId>
|
<groupId>org.json</groupId>
|
||||||
<artifactId>json</artifactId>
|
<artifactId>json</artifactId>
|
||||||
|
|||||||
@@ -1,21 +1,20 @@
|
|||||||
package org.nl.acs.address.rest;
|
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.AddressService;
|
||||||
import org.nl.acs.address.service.dto.AddressDto;
|
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 org.springframework.data.domain.Pageable;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import io.swagger.annotations.*;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jiaolm
|
* @author jiaolm
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ package org.nl.acs.udw.service;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.nl.acs.udw.dto.UdwDto;
|
import org.nl.acs.udw.dto.UdwDto;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface UdwManageService {
|
public interface UdwManageService {
|
||||||
/**
|
/**
|
||||||
@@ -13,4 +15,14 @@ public interface UdwManageService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<UdwDto> queryByConditions(JSONObject where);
|
List<UdwDto> queryByConditions(JSONObject where);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据分页
|
||||||
|
*
|
||||||
|
* @param whereJson 条件
|
||||||
|
* @param page 分页参数
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,157 @@
|
|||||||
package org.nl.acs.udw.service.impl;
|
package org.nl.acs.udw.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
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.dto.UdwDto;
|
||||||
import org.nl.acs.udw.service.UdwManageService;
|
import org.nl.acs.udw.service.UdwManageService;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class UdwManagerServiceImpl implements UdwManageService {
|
public class UdwManagerServiceImpl implements UdwManageService {
|
||||||
|
|
||||||
|
public UdwManagerServiceImpl() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<UdwDto> queryByConditions(JSONObject where) {
|
public List<UdwDto> queryByConditions(JSONObject where) {
|
||||||
|
String unified_key = null;
|
||||||
|
String keys = null;
|
||||||
|
|
||||||
|
UnifiedDataUnit unifiedDataUnit = UnifiedDataAccessorFactory.getUnifiedDataAppService().getUnifiedDataUnit(unified_key);
|
||||||
|
if (unifiedDataUnit == null) {
|
||||||
return 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<String, Object> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,7 @@
|
|||||||
v-loading="crud.loading"
|
v-loading="crud.loading"
|
||||||
:data="crud.data"
|
:data="crud.data"
|
||||||
fit="fit"
|
fit="fit"
|
||||||
size="medium"
|
size="mini"
|
||||||
style="width: 100%;"
|
style="width: 100%;"
|
||||||
@selection-change="crud.selectionChangeHandler"
|
@selection-change="crud.selectionChangeHandler"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user