Commit fc09fa35 authored by 赵啸非's avatar 赵啸非

修改pom文件

parent c823a09a
......@@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
/**
* 流程定义部署接口类
* 设备
*
* @author: zxfei
* @date: 2021/8/24 20:28
......@@ -47,6 +47,7 @@ public class DeviceApiController {
*/
@PostMapping("upload")
public String upload(DeviceReq req) {
log.info("【设备数据上报】【请求体】--> " + JSONObject.toJSONString(req));
ApiResp rsp = new ApiResp<>();
rsp.setMsg(ApiRespCodeEnum.SUCCESS.getLabel());
rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
......@@ -80,7 +81,27 @@ public class DeviceApiController {
}
} else {
throw new AppException("未找到当前设备,devicenum:" + req.getDevicenum());
//新增设备
deviceEntity = new DeviceEntity();
deviceEntity.initAttrValue();
deviceEntity.setDeviceCode(req.getDevicenum());
deviceEntity.setOnlineTime(new Date());
deviceEntity.setDeviceOnlineStatus(DeviceOnlineStatusEnum.在线.getValue());
deviceEntity.setIp(req.getIp());
deviceEntity.setPort(req.getPort());
deviceEntity.setSiteNum(req.getSitenum());
deviceEntity.setCenternum(req.getCenternum());
deviceService.save(deviceEntity);
DeviceLogEntity deviceLogEntity = new DeviceLogEntity();
deviceLogEntity.initAttrValue();
deviceLogEntity.setDeviceId(deviceEntity.getId());
deviceLogEntity.setDeviceName(deviceEntity.getDeviceName());
deviceLogEntity.setDeviceNum(deviceEntity.getDeviceCode());
deviceLogEntity.setContent(JSONObject.toJSONString(req));
deviceLogEntity.setCreateTime(new Date());
deviceLogService.save(deviceLogEntity);
WebSocketUtil.broadcast(SendToAllRequest.TYPE, new SendToAllRequest().setContent(JSON.toJSONString(deviceEntity)));
}
} catch (Exception e) {
......@@ -90,7 +111,7 @@ public class DeviceApiController {
return JSON.toJSONString(rsp);
}
log.info("响应【启动】【响应体】--> " + JSONObject.toJSONString(rsp));
log.info("响应【设备数据上报】【响应体】--> " + JSONObject.toJSONString(rsp));
return JSON.toJSONString(rsp);
}
......
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