|
|
@@ -755,4 +755,53 @@ public class IotRunHaoSfServiceImpl extends IIotSfCommService {
|
|
|
}
|
|
|
return groupParamJson;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑灌区参数
|
|
|
+ *
|
|
|
+ * @param reqVo 包含设备添加请求的参数,包括设备标识(devBid)等
|
|
|
+ * @param reqVo
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public String editGroupParamByGlobal (IotSfGroupParamEditReqVo reqVo) {
|
|
|
+ String devBid = reqVo.getDevBid();
|
|
|
+ IotDevice iotDevice = iotDeviceService.selectIotDeviceByDevBid(devBid);
|
|
|
+ if(iotDevice == null){
|
|
|
+ throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备不存在");
|
|
|
+ }
|
|
|
+ DevOperateUtil.sendConfigCmdCheck(iotDevice);
|
|
|
+
|
|
|
+ JSONObject groupParamJson = reqVo.getParamJson();
|
|
|
+ if(groupParamJson == null){
|
|
|
+ throw new IotBizException(IotErrorCode.PARAM_INVALID.getCode(), "参数不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, String> groupParamMap = new HashMap<>();
|
|
|
+ groupParamMap.put("Num-ggsj", "Btn-ggxr");
|
|
|
+ groupParamMap.put("Num-fqsj", "Btn-fqxr");
|
|
|
+ groupParamMap.put("Btn-fxz", "Btn-fxr");
|
|
|
+ groupParamMap.put("Num-fsj", "Btn-fsxr");
|
|
|
+
|
|
|
+ JSONObject sendJson = new JSONObject();
|
|
|
+ for(String key : groupParamJson.keySet()) {
|
|
|
+ for(String groupKey : groupParamMap.keySet()){
|
|
|
+ if(key.startsWith(groupKey)){
|
|
|
+ String sendKey = groupParamMap.get(groupKey) + key.replace(groupKey, "");
|
|
|
+ sendJson.put(key, groupParamJson.getString(key));
|
|
|
+ sendJson.put(sendKey, "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!sendJson.isEmpty()){
|
|
|
+ sendJson.put("Btn-csbc", "1");
|
|
|
+ }
|
|
|
+
|
|
|
+ IotSfConfigCmdReqVo cmdReqVo = new IotSfConfigCmdReqVo();
|
|
|
+ cmdReqVo.setDevBid(devBid);
|
|
|
+ cmdReqVo.setCmd(CmdDef.RunHaoSfCmdDef.CMD_CONFIG);
|
|
|
+ cmdReqVo.setIotDevice(iotDevice);
|
|
|
+ cmdReqVo.setData(sendJson);
|
|
|
+ return sendConfigCmd(cmdReqVo);
|
|
|
+ }
|
|
|
}
|