diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/udw/rest/UdwManagerController.java b/acs/nladmin-system/src/main/java/org/nl/acs/udw/rest/UdwManagerController.java new file mode 100644 index 0000000..cd0f85f --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/udw/rest/UdwManagerController.java @@ -0,0 +1,59 @@ + +package org.nl.acs.udw.rest; + + +import cn.dev33.satoken.annotation.SaIgnore; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.device_driver.DriverTypeEnum; +import org.nl.acs.device.device_driver.standard_inspect.OpcPlcDto; +import org.nl.acs.device.service.DeviceExtraService; +import org.nl.acs.device.service.DeviceService; +import org.nl.acs.device.service.dto.DeviceDto; +import org.nl.acs.udw.service.UdwManageService; +import org.nl.modules.logging.annotation.Log; +import org.nl.modules.wql.core.bean.WQLObject; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +@RestController +@RequiredArgsConstructor +@Api(tags = "内存点位管理") +@RequestMapping("/api/udw") +@Slf4j +public class UdwManagerController { + + private final UdwManageService udwManageService; + +// @GetMapping +// @Log("查询内存点位") +// @ApiOperation("查询内存点位") +// @SaIgnore +// public ResponseEntity query(@RequestParam JSONObject whereJson) { +// return new ResponseEntity<>(udwManageService.queryByConditions(whereJson), HttpStatus.OK); +// } + + @GetMapping + @Log("查询内存点位") + @ApiOperation("查询内存点位") + @SaIgnore + //@PreAuthorize("@el.check('device:list')") + public ResponseEntity query(@RequestParam Map whereJson, Pageable page) { + return new ResponseEntity<>(udwManageService.queryAll(whereJson, page), HttpStatus.OK); + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/udw/service/UdwManageService.java b/acs/nladmin-system/src/main/java/org/nl/acs/udw/service/UdwManageService.java index 034bd3f..6d3ef62 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/udw/service/UdwManageService.java +++ b/acs/nladmin-system/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/src/main/java/org/nl/acs/udw/service/impl/UdwManagerServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/udw/service/impl/UdwManagerServiceImpl.java index b5f377c..e03e26f 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/udw/service/impl/UdwManagerServiceImpl.java +++ b/acs/nladmin-system/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/api/acs/history/acsDeviceErrorLog.js b/acs/nladmin-ui/src/api/acs/history/acsDeviceErrorLog.js new file mode 100644 index 0000000..12f1337 --- /dev/null +++ b/acs/nladmin-ui/src/api/acs/history/acsDeviceErrorLog.js @@ -0,0 +1,27 @@ +import request from '@/utils/request' + +export function add(data) { + return request({ + url: 'api/deviceErrorLog', + method: 'post', + data + }) +} + +export function del(ids) { + return request({ + url: 'api/deviceErrorLog/', + method: 'delete', + data: ids + }) +} + +export function edit(data) { + return request({ + url: 'api/deviceErrorLog', + method: 'put', + data + }) +} + +export default { add, edit, del } diff --git a/acs/nladmin-ui/src/api/acs/history/udwData.js b/acs/nladmin-ui/src/api/acs/history/udwData.js new file mode 100644 index 0000000..f3d3c5d --- /dev/null +++ b/acs/nladmin-ui/src/api/acs/history/udwData.js @@ -0,0 +1,28 @@ +import request from '@/utils/request' + +export function add(data) { + return request({ + url: 'api/task', + method: 'post', + data + }) +} + +export function del(ids) { + return request({ + url: 'api/task/', + method: 'delete', + data: ids + }) +} + +export function edit(data) { + return request({ + url: 'api/task', + method: 'put', + data + }) +} + +export default { edit, del } + diff --git a/acs/nladmin-ui/src/views/acs/history/udwData/index.vue b/acs/nladmin-ui/src/views/acs/history/udwData/index.vue new file mode 100644 index 0000000..17f53a1 --- /dev/null +++ b/acs/nladmin-ui/src/views/acs/history/udwData/index.vue @@ -0,0 +1,181 @@ + + + + +