Browse Source

优化根据桩号范围查询设备接口 新增条件 设备类型

develop
zhaoxianglong 10 months ago
parent
commit
0060647f1b
  1. 2
      zc-business/src/main/java/com/zc/business/controller/BroadcastController.java
  2. 2
      zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java
  3. 2
      zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java
  4. 12
      zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java
  5. 2
      zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java
  6. 23
      zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java

2
zc-business/src/main/java/com/zc/business/controller/BroadcastController.java

@ -24,7 +24,7 @@ import static com.ruoyi.common.constant.Constants.HTTP;
/**
* License
*
* @author Athena-xiepufeng
* @author Athena-zhaoxianglong
*/
@Api(tags = "广播接口")
@RestController

2
zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java

@ -18,7 +18,7 @@ import java.util.Objects;
/**
* License
*
* @author Athena-xiepufeng
* @author Athena-zhaoxianglong
*/
@Api(tags = "扫码报警")
@RestController

2
zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java

@ -93,7 +93,7 @@ public class DcDeviceController extends BaseController {
@ApiOperation("无分页根据设备桩号查询设备列表")
@PreAuthorize("@ss.hasPermi('iot:device:query')")
@PostMapping("pileNumberQuery")
public AjaxResult devicePileNumberQueryDevice(@RequestBody Map<String,List> parameter) {
public AjaxResult devicePileNumberQueryDevice(@RequestBody Map<String,Object> parameter) {
return AjaxResult.success(dcDeviceService.devicePileNumberQueryDevice(parameter));
}

12
zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java

@ -29,7 +29,7 @@ import java.util.Objects;
/**
* License
*
* @author Athena-xiepufeng
* @author Athena-zhaoxianglong
*/
@Api(tags = "非机预警接口")
@RestController
@ -102,7 +102,12 @@ public class NonAutomaticWarningController extends BaseController {
client.setCallback(new MqttCallback() {
public void connectionLost(Throwable cause) {
System.out.println("connectionLost");
System.out.println("断开连接");
//try {
// eventSubscription();
//} catch (Exception e) {
// throw new RuntimeException(e);
//}
}
public void messageArrived(String topic, MqttMessage message) {
@ -195,9 +200,6 @@ public class NonAutomaticWarningController extends BaseController {
dcWarning.setStakeMark("k190+495");
}
dcWarning.setWarningTitle(crossingName+srcName);
//设置事件Id UUID无下划线格式32
String uuid = IdUtils.fastSimpleUUID();
dcWarning.setId(uuid);
dcWarning.setWarningSource(6);
dcWarning.setWarningState(1);
dcWarningService.insertDcWarning(dcWarning);

2
zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java

@ -76,5 +76,5 @@ public interface IDcDeviceService extends IService<DcDevice> {
Long statisticalAnomalyDevice();
List<DcDevice> devicePileNumberQueryDevice(Map<String,List> parameter);
List<DcDevice> devicePileNumberQueryDevice(Map<String,Object> parameter);
}

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

@ -298,14 +298,18 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
}
@Override
public List<DcDevice> devicePileNumberQueryDevice(Map<String, List> parameter) {
public List<DcDevice> devicePileNumberQueryDevice(Map<String, Object> parameter) {
ArrayList<DcDevice> dcDevices = new ArrayList<>();
Integer startStakeMark = Integer.parseInt(String.valueOf(parameter.get("startStakeMark").get(0)) + String.valueOf(parameter.get("startStakeMark").get(1)));
Integer endStakeMark = Integer.parseInt(String.valueOf(parameter.get("endStakeMark").get(0)) + String.valueOf(parameter.get("endStakeMark").get(1)));
List<String> startStakeMarks = castList(parameter.get("startStakeMark"), String.class);
List<String> endStakeMarks = castList(parameter.get("endStakeMark"), String.class);
String deviceType = String.valueOf(parameter.get("deviceType"));
Integer startStakeMark = Integer.parseInt(startStakeMarks.get(0) + startStakeMarks.get(1));
Integer endStakeMark = Integer.parseInt(endStakeMarks.get(0) + endStakeMarks.get(1));
LambdaQueryWrapper<DcDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
ArrayList<Integer> integers = new ArrayList<>();
integers.add(6);
lambdaQueryWrapper.notIn(DcDevice::getDeviceType,integers);
lambdaQueryWrapper.notIn(DcDevice::getDeviceType, integers);
lambdaQueryWrapper.eq(DcDevice::getDeviceType, deviceType);
List<DcDevice> list = list(lambdaQueryWrapper);
for (DcDevice dcDevice : list) {
String stakeMark = dcDevice.getStakeMark();
@ -336,5 +340,16 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
return dcDevices;
}
public static <T> List<T> castList(Object obj, Class<T> clazz) {
List<T> result = new ArrayList<T>();
if (obj instanceof List<?>) {
for (Object o : (List<?>) obj) {
result.add(clazz.cast(o));
}
return result;
}
return null;
}
}

Loading…
Cancel
Save