From c2f3847122f84fa82529ef1d47c373641a2274b2 Mon Sep 17 00:00:00 2001 From: zhaoxianglong Date: Fri, 26 Jul 2024 11:53:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AF=AD=E9=9F=B3=E5=B9=BF?= =?UTF-8?q?=E6=92=AD=E8=AE=BE=E5=A4=87=E5=8A=9F=E8=83=BD=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=86=85=E5=AE=B9=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E6=8E=A7=E8=AE=B0=E5=BD=95=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BroadcastController.java | 8 ++--- .../interfaces/OperationLogAspect.java | 2 +- .../service/impl/DcDeviceServiceImpl.java | 34 ++++++++++--------- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/BroadcastController.java b/zc-business/src/main/java/com/zc/business/controller/BroadcastController.java index 85f50d7b..ab654bbb 100644 --- a/zc-business/src/main/java/com/zc/business/controller/BroadcastController.java +++ b/zc-business/src/main/java/com/zc/business/controller/BroadcastController.java @@ -78,10 +78,10 @@ public class BroadcastController extends BaseController { OkHttp okHttp = new OkHttp(UniversalEnum.ONE.getNumber()); RequestParams requestParams = new RequestParams(params); String tokenRoadTestBroadcastPlatform = redisCache.getCacheObject(broadcast.getString("TOKENKEY")); - if (tokenRoadTestBroadcastPlatform == null) { - tokenRoadTestBroadcastPlatform = getToken(); - } try { + if (tokenRoadTestBroadcastPlatform == null) { + tokenRoadTestBroadcastPlatform = getToken(); + } Response response // 请求响应 = okHttp .headers(new HashMap<>()) @@ -94,7 +94,7 @@ public class BroadcastController extends BaseController { } catch (SocketTimeoutException e) { if (numberOfReconnections < UniversalEnum.THREE.getNumber()) { numberOfReconnections += UniversalEnum.ONE.getNumber(); - getToken(); + //getToken(); return nearCamListDistance(params); } else { jsonResult = new JSONObject(); diff --git a/zc-business/src/main/java/com/zc/business/interfaces/OperationLogAspect.java b/zc-business/src/main/java/com/zc/business/interfaces/OperationLogAspect.java index ef315c2e..19b1bdd8 100644 --- a/zc-business/src/main/java/com/zc/business/interfaces/OperationLogAspect.java +++ b/zc-business/src/main/java/com/zc/business/interfaces/OperationLogAspect.java @@ -653,7 +653,7 @@ public class OperationLogAspect { operLog.setOperTime(new Date()); operLog.setDcDeviceType(deviceType); operLog.setRemark(remark.toString()); - operLog.setJsonResult(jsonResult != null ? jsonResult.toJSONString() : AjaxResult.error().toString()); + operLog.setJsonResult(jsonResult != null ? jsonResult.toJSONString() : JSON.toJSON(AjaxResult.error()).toString()); dcOperLogService.save(operLog); } } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java index 33ea862f..55c3beae 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java @@ -388,6 +388,7 @@ public class DcDeviceServiceImpl extends ServiceImpl i /** * 根据网段查询设备 + * * @param networkSegment * @return */ @@ -402,7 +403,7 @@ public class DcDeviceServiceImpl extends ServiceImpl i * 根据网段分组查询分组设备 */ @Override - public Map> getGroupingDeviceByNetworkSegment() { + public Map> getGroupingDeviceByNetworkSegment() { List deviceList = dcDeviceMapper.selectDcDeviceList(new DcDevice()); return deviceList.stream() .collect(Collectors.groupingBy(DcDevice::getNetworkSegment)); @@ -424,7 +425,7 @@ public class DcDeviceServiceImpl extends ServiceImpl i public Long statisticalAnomalyDevice() { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(DcDevice::getDeviceState, UniversalEnum.ZERO.getNumber()).or().isNull(DcDevice::getDeviceState); - lambdaQueryWrapper.eq(DcDevice::getUseState,UniversalEnum.ONE.getNumber()); + lambdaQueryWrapper.eq(DcDevice::getUseState, UniversalEnum.ONE.getNumber()); return (long) list(lambdaQueryWrapper).size(); } @@ -455,7 +456,7 @@ public class DcDeviceServiceImpl extends ServiceImpl i device.setDirection(direction); } List list = listDevice(device); - if (startStakeMarks != null && endStakeMarks != null) { + if (startStakeMarks != null && startStakeMarks.size() != UniversalEnum.ZERO.getNumber() && endStakeMarks != null && endStakeMarks.size() != UniversalEnum.ZERO.getNumber()) { Integer startStakeMark = Integer.parseInt(startStakeMarks.get(UniversalEnum.ZERO.getNumber()) + startStakeMarks.get(UniversalEnum.ONE.getNumber())); Integer endStakeMark = Integer.parseInt(endStakeMarks.get(UniversalEnum.ZERO.getNumber()) + endStakeMarks.get(UniversalEnum.ONE.getNumber())); for (DcDevice dcDevice : list) { @@ -519,31 +520,30 @@ public class DcDeviceServiceImpl extends ServiceImpl i } @Override - public List selectNearCamPile(String direction,String startMileage,String endMileage){ - return dcDeviceMapper.selectNearCamPile(direction,startMileage,endMileage); + public List selectNearCamPile(String direction, String startMileage, String endMileage) { + return dcDeviceMapper.selectNearCamPile(direction, startMileage, endMileage); } /** - * @Description 获取事发地上游10公里内的情报板 - * - * @author liuwenge - * @date 2024/4/15 14:18 * @param stakeMark 桩号 * @param direction 方向 * @return com.ruoyi.common.core.domain.AjaxResult + * @Description 获取事发地上游10公里内的情报板 + * @author liuwenge + * @date 2024/4/15 14:18 */ @Override - public AjaxResult selectNearBoard(String stakeMark, String direction){ + public AjaxResult selectNearBoard(String stakeMark, String direction) { Integer mileage = Integer.valueOf(StakeMarkUtils.formatMetre(stakeMark)); List boardList = new ArrayList<>(); - if (UniversalEnum.ONE.getValue().equals(direction)){ + if (UniversalEnum.ONE.getValue().equals(direction)) { Integer start = mileage - UniversalEnum.TEN_THOUSAND.getNumber(); - boardList = dcDeviceMapper.selectNearBoard(direction,start,mileage); - } else if (UniversalEnum.THREE.getValue().equals(direction)){ + boardList = dcDeviceMapper.selectNearBoard(direction, start, mileage); + } else if (UniversalEnum.THREE.getValue().equals(direction)) { Integer end = mileage + UniversalEnum.TEN_THOUSAND.getNumber(); - boardList = dcDeviceMapper.selectNearBoard(direction,mileage,end); + boardList = dcDeviceMapper.selectNearBoard(direction, mileage, end); } return AjaxResult.success(boardList); } @@ -553,6 +553,7 @@ public class DcDeviceServiceImpl extends ServiceImpl i public List> selectDeviceNameList(DcDevice dcDevice) { return dcDeviceMapper.selectDeviceNameList(dcDevice); } + //设备查询-设备参数属性列表 @Override public List> selectDeviceParameterProperties(DcDevice dcDevice) { @@ -574,9 +575,10 @@ public class DcDeviceServiceImpl extends ServiceImpl i .get(); // 请求方法 return JSON.parseObject(response.body().string(), AjaxResult.class); } - public List> selectDeviceOfRoad(){ + + public List> selectDeviceOfRoad() { return dcDeviceMapper.selectDeviceOfRoad(); - } + } }