|
@@ -1395,6 +1395,7 @@ public class DeviceServiceImpl implements DeviceService {
|
|
|
@Override
|
|
|
public void setValve(Long deviceId) {
|
|
|
Device device = deviceMapper.findByDeviceId(deviceId);
|
|
|
+ DeviceTypeDto deviceTypeDto = deviceTypeMapper.getById(device.getDeviceType());
|
|
|
WaterMeterErrorDays waterMeterErrorDays = waterMeterErrorDaysMapper.findByDeviceId(deviceId);
|
|
|
String sendValveStatus = "0";
|
|
|
|
|
@@ -1406,36 +1407,41 @@ public class DeviceServiceImpl implements DeviceService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(device.getDeviceType()==30){
|
|
|
- //1、下发开关阀门
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
- Map<String,Object> paras = new HashMap<>();
|
|
|
- paras.put("electronicNo",device.getWaterMeterNo());
|
|
|
- paras.put("valveStatus", sendValveStatus);//阀门状态 0:关阀 1:开阀
|
|
|
- map.put("params", paras);
|
|
|
- map.put("method", "WriteValve");
|
|
|
- easylinkinUtils.sendDownlink(device.getDeviceNo(),map);
|
|
|
- }else if(device.getDeviceType()==19)
|
|
|
+ ValveCommandRequestDTO valveCommandRequest = new ValveCommandRequestDTO();
|
|
|
+ valveCommandRequest.setValveStatus(sendValveStatus);
|
|
|
+
|
|
|
+ //1、下发开关阀门
|
|
|
+ if(StringUtils.equals("lora188",deviceTypeDto.getEnModel())){
|
|
|
+ valveCommandRequest.setMeterCode(device.getWaterMeterNo());
|
|
|
+ easylinkinUtils.sendDownlink(device.getDeviceNo(),valveCommandRequest);
|
|
|
+ }else if(StringUtils.equals("hxgd",deviceTypeDto.getEnModel()))
|
|
|
{
|
|
|
- Boolean valveStatus = false;
|
|
|
- if(sendValveStatus.equals("1")){
|
|
|
- valveStatus = true;
|
|
|
- }
|
|
|
- gdAgentUtils.setMeterValve(deviceId,valveStatus);
|
|
|
- }else
|
|
|
+ valveCommandRequest.setMeterCode(String.valueOf(deviceId));
|
|
|
+ gdAgentUtils.setMeterValve(valveCommandRequest);
|
|
|
+ }
|
|
|
+ else if(StringUtils.equals("hengxin-nb",deviceTypeDto.getEnModel()))
|
|
|
+ {
|
|
|
+ valveCommandRequest.setMeterCode(device.getWaterMeterNo());
|
|
|
+ udipEtlDataCommandService.commandSendV2(device.getUdipId(),valveCommandRequest);
|
|
|
+ }
|
|
|
+ else if(StringUtils.equals("ningbo-nb",deviceTypeDto.getEnModel()))
|
|
|
+ {
|
|
|
+ valveCommandRequest.setMeterCode(device.getWaterMeterNo());
|
|
|
+ JSONObject commandResult = udipEtlDataCommandService.commandSendV2(device.getUdipId(),valveCommandRequest);
|
|
|
+
|
|
|
+ //2、插入开关阀门记录
|
|
|
+ DeviceValveRecord deviceValveRecord = new DeviceValveRecord();
|
|
|
+ deviceValveRecord.setDeviceId(deviceId);
|
|
|
+ deviceValveRecord.setSendValveStatus(Integer.valueOf(sendValveStatus));
|
|
|
+ deviceValveRecord.setSendStatus(1);
|
|
|
+ deviceValveRecord.setCommandId(commandResult.getString("commandId"));
|
|
|
+ deviceValveRecord.setRemark("");
|
|
|
+ deviceValveRecordService.insertSelective(deviceValveRecord);
|
|
|
+ }else if(StringUtils.equals("NB-TJ2.0",deviceTypeDto.getEnModel()))
|
|
|
{
|
|
|
if (device.getUdipId() != null && !"".equals(device.getUdipId())) {
|
|
|
- //1、下发开关阀门
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
- map.put("electronicNo","AAAAAAAAAAAAAA");
|
|
|
- map.put("valveStatus", sendValveStatus);//阀门状态 0:关阀 1:开阀
|
|
|
- DataCommandRequestDTO dataCommandRequest = new DataCommandRequestDTO();
|
|
|
- dataCommandRequest.setDeviceId(device.getUdipId());
|
|
|
- dataCommandRequest.setUnitIdentifier(device.getDeviceNo());
|
|
|
- dataCommandRequest.setReceiveTime(new Date());
|
|
|
- dataCommandRequest.setMethod("WriteValve");
|
|
|
- dataCommandRequest.setParams(map);
|
|
|
- JSONObject commandResult = udipEtlDataCommandService.commandSend(dataCommandRequest);
|
|
|
+ valveCommandRequest.setMeterCode(device.getDeviceNo());
|
|
|
+ JSONObject commandResult = udipEtlDataCommandService.commandSend(device.getUdipId(),valveCommandRequest);
|
|
|
|
|
|
//2、插入开关阀门记录
|
|
|
DeviceValveRecord deviceValveRecord = new DeviceValveRecord();
|
|
@@ -1447,6 +1453,8 @@ public class DeviceServiceImpl implements DeviceService {
|
|
|
deviceValveRecord.setRemark("");
|
|
|
deviceValveRecordService.insertSelective(deviceValveRecord);
|
|
|
}
|
|
|
+ }else {
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|