Browse Source

优化语音广播设备功能调用返回内容

优化设备管控记录返回内容
develop
zhaoxianglong 4 months ago
parent
commit
c2f3847122
  1. 8
      zc-business/src/main/java/com/zc/business/controller/BroadcastController.java
  2. 2
      zc-business/src/main/java/com/zc/business/interfaces/OperationLogAspect.java
  3. 34
      zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java

8
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()); OkHttp okHttp = new OkHttp(UniversalEnum.ONE.getNumber());
RequestParams requestParams = new RequestParams(params); RequestParams requestParams = new RequestParams(params);
String tokenRoadTestBroadcastPlatform = redisCache.getCacheObject(broadcast.getString("TOKENKEY")); String tokenRoadTestBroadcastPlatform = redisCache.getCacheObject(broadcast.getString("TOKENKEY"));
if (tokenRoadTestBroadcastPlatform == null) {
tokenRoadTestBroadcastPlatform = getToken();
}
try { try {
if (tokenRoadTestBroadcastPlatform == null) {
tokenRoadTestBroadcastPlatform = getToken();
}
Response response // 请求响应 Response response // 请求响应
= okHttp = okHttp
.headers(new HashMap<>()) .headers(new HashMap<>())
@ -94,7 +94,7 @@ public class BroadcastController extends BaseController {
} catch (SocketTimeoutException e) { } catch (SocketTimeoutException e) {
if (numberOfReconnections < UniversalEnum.THREE.getNumber()) { if (numberOfReconnections < UniversalEnum.THREE.getNumber()) {
numberOfReconnections += UniversalEnum.ONE.getNumber(); numberOfReconnections += UniversalEnum.ONE.getNumber();
getToken(); //getToken();
return nearCamListDistance(params); return nearCamListDistance(params);
} else { } else {
jsonResult = new JSONObject(); jsonResult = new JSONObject();

2
zc-business/src/main/java/com/zc/business/interfaces/OperationLogAspect.java

@ -653,7 +653,7 @@ public class OperationLogAspect {
operLog.setOperTime(new Date()); operLog.setOperTime(new Date());
operLog.setDcDeviceType(deviceType); operLog.setDcDeviceType(deviceType);
operLog.setRemark(remark.toString()); 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); dcOperLogService.save(operLog);
} }
} }

34
zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java

@ -388,6 +388,7 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
/** /**
* 根据网段查询设备 * 根据网段查询设备
*
* @param networkSegment * @param networkSegment
* @return * @return
*/ */
@ -402,7 +403,7 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
* 根据网段分组查询分组设备 * 根据网段分组查询分组设备
*/ */
@Override @Override
public Map<String,List<DcDevice>> getGroupingDeviceByNetworkSegment() { public Map<String, List<DcDevice>> getGroupingDeviceByNetworkSegment() {
List<DcDevice> deviceList = dcDeviceMapper.selectDcDeviceList(new DcDevice()); List<DcDevice> deviceList = dcDeviceMapper.selectDcDeviceList(new DcDevice());
return deviceList.stream() return deviceList.stream()
.collect(Collectors.groupingBy(DcDevice::getNetworkSegment)); .collect(Collectors.groupingBy(DcDevice::getNetworkSegment));
@ -424,7 +425,7 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
public Long statisticalAnomalyDevice() { public Long statisticalAnomalyDevice() {
LambdaQueryWrapper<DcDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<DcDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(DcDevice::getDeviceState, UniversalEnum.ZERO.getNumber()).or().isNull(DcDevice::getDeviceState); 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(); return (long) list(lambdaQueryWrapper).size();
} }
@ -455,7 +456,7 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
device.setDirection(direction); device.setDirection(direction);
} }
List<DcDevice> list = listDevice(device); List<DcDevice> 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 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())); Integer endStakeMark = Integer.parseInt(endStakeMarks.get(UniversalEnum.ZERO.getNumber()) + endStakeMarks.get(UniversalEnum.ONE.getNumber()));
for (DcDevice dcDevice : list) { for (DcDevice dcDevice : list) {
@ -519,31 +520,30 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
} }
@Override @Override
public List<DcDevice> selectNearCamPile(String direction,String startMileage,String endMileage){ public List<DcDevice> selectNearCamPile(String direction, String startMileage, String endMileage) {
return dcDeviceMapper.selectNearCamPile(direction,startMileage,endMileage); return dcDeviceMapper.selectNearCamPile(direction, startMileage, endMileage);
} }
/** /**
* @Description 获取事发地上游10公里内的情报板
*
* @author liuwenge
* @date 2024/4/15 14:18
* @param stakeMark 桩号 * @param stakeMark 桩号
* @param direction 方向 * @param direction 方向
* @return com.ruoyi.common.core.domain.AjaxResult * @return com.ruoyi.common.core.domain.AjaxResult
* @Description 获取事发地上游10公里内的情报板
* @author liuwenge
* @date 2024/4/15 14:18
*/ */
@Override @Override
public AjaxResult selectNearBoard(String stakeMark, String direction){ public AjaxResult selectNearBoard(String stakeMark, String direction) {
Integer mileage = Integer.valueOf(StakeMarkUtils.formatMetre(stakeMark)); Integer mileage = Integer.valueOf(StakeMarkUtils.formatMetre(stakeMark));
List<DcDevice> boardList = new ArrayList<>(); List<DcDevice> boardList = new ArrayList<>();
if (UniversalEnum.ONE.getValue().equals(direction)){ if (UniversalEnum.ONE.getValue().equals(direction)) {
Integer start = mileage - UniversalEnum.TEN_THOUSAND.getNumber(); Integer start = mileage - UniversalEnum.TEN_THOUSAND.getNumber();
boardList = dcDeviceMapper.selectNearBoard(direction,start,mileage); boardList = dcDeviceMapper.selectNearBoard(direction, start, mileage);
} else if (UniversalEnum.THREE.getValue().equals(direction)){ } else if (UniversalEnum.THREE.getValue().equals(direction)) {
Integer end = mileage + UniversalEnum.TEN_THOUSAND.getNumber(); Integer end = mileage + UniversalEnum.TEN_THOUSAND.getNumber();
boardList = dcDeviceMapper.selectNearBoard(direction,mileage,end); boardList = dcDeviceMapper.selectNearBoard(direction, mileage, end);
} }
return AjaxResult.success(boardList); return AjaxResult.success(boardList);
} }
@ -553,6 +553,7 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
public List<HashMap<String, Object>> selectDeviceNameList(DcDevice dcDevice) { public List<HashMap<String, Object>> selectDeviceNameList(DcDevice dcDevice) {
return dcDeviceMapper.selectDeviceNameList(dcDevice); return dcDeviceMapper.selectDeviceNameList(dcDevice);
} }
//设备查询-设备参数属性列表 //设备查询-设备参数属性列表
@Override @Override
public List<HashMap<String, Object>> selectDeviceParameterProperties(DcDevice dcDevice) { public List<HashMap<String, Object>> selectDeviceParameterProperties(DcDevice dcDevice) {
@ -574,9 +575,10 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
.get(); // 请求方法 .get(); // 请求方法
return JSON.parseObject(response.body().string(), AjaxResult.class); return JSON.parseObject(response.body().string(), AjaxResult.class);
} }
public List<Map<String,Object>> selectDeviceOfRoad(){
public List<Map<String, Object>> selectDeviceOfRoad() {
return dcDeviceMapper.selectDeviceOfRoad(); return dcDeviceMapper.selectDeviceOfRoad();
} }
} }

Loading…
Cancel
Save