Commit cf5447e3 authored by 廖旭伟's avatar 廖旭伟

修改下发设备开柜指令

parent 4439c66a
package com.mortals.xhx.module.device.model;
import lombok.Data;
@Data
public class DeviceOpenBoxPdu {
/*** 目标设备 */
private String targetDevice;
/** 指令来源 **/
private String sourceDevice;
}
......@@ -18,6 +18,7 @@ import com.mortals.xhx.feign.device.IDeviceAlarmFeign;
import com.mortals.xhx.feign.device.IDeviceFeign;
import com.mortals.xhx.feign.device.IDeviceModuleUseFeign;
import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.model.DeviceOpenBoxPdu;
import com.mortals.xhx.module.device.service.DeviceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
......@@ -251,19 +252,22 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
@PostMapping({"openBox"})
@UnAuth
public Rest<Object> openBox(@RequestBody DeviceEntity device) {
public Rest<Object> openBox(@RequestBody DeviceOpenBoxPdu device) {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "设备开柜";
String busiDesc = "设备开柜指令发送";
int code=1;
try {
DeviceNotifyPdu pdu = new DeviceNotifyPdu();
List<String> deviceCodeList = new ArrayList<>();
deviceCodeList.add(device.getDeviceCode());
deviceCodeList.add(device.getTargetDevice());
pdu.setDeviceCodeList(deviceCodeList);
pdu.setAction("openBox");
JSONObject jsonObject = new JSONObject();
jsonObject.put("zzfwzd",device.getSourceDevice()); //自助服务终端设备编码
pdu.setContent(jsonObject.toJSONString());
Rest<String> rest = deviceFeign.downMsg(pdu);
if(rest.getCode()==1) {
model.put("message_info", busiDesc + "成功");
......@@ -284,4 +288,5 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment