Commit 100399d3 authored by 赵啸非's avatar 赵啸非

添加智慧办公回调信息

parent 091e9b9a
package com.mortals.xhx.busiz.req;
package com.mortals.xhx.common.pdu;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.mortals.xhx.base.framework.CustomJsonDateDeserializer;
import lombok.Data;
import java.io.Serializable;
......@@ -115,7 +113,6 @@ public class DeviceReq implements Serializable {
/**
* 保修期至
*/
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
private Date defectsLiabilityPeriod;
/**
......
package com.mortals.xhx.feign;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.common.pdu.DeviceReq;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* 设备 Feign接口
*
* @author zxfei
* @date 2023-02-25
*/
@FeignClient(name = "smart-office-manager", path = "/office", fallbackFactory = OfficeDeviceFeignFallbackFactory.class)
public interface IOfficeDeviceFeign extends IFeign {
/**
* 设备回调
*
* @param deviceReq
* @return
*/
@PostMapping(value = "/api/device/callback")
Rest<String> deviceCall(@RequestBody DeviceReq deviceReq);
}
@Slf4j
@Component
class OfficeDeviceFeignFallbackFactory implements FallbackFactory<IOfficeDeviceFeign> {
@Override
public IOfficeDeviceFeign create(Throwable t) {
return new IOfficeDeviceFeign() {
@Override
public Rest<String> deviceCall(DeviceReq deviceReq) {
return Rest.fail();
}
};
}
}
package com.mortals.xhx.base.system.message;
import com.mortals.xhx.busiz.req.DeviceReq;
import com.mortals.xhx.busiz.rsp.ApiResp;
import com.mortals.xhx.common.pdu.DeviceReq;
import com.mortals.xhx.queue.TbQueueCallback;
import com.mortals.xhx.queue.TbQueueMsgHeaders;
import com.mortals.xhx.queue.TopicPartitionInfo;
......
......@@ -10,12 +10,12 @@ import com.mortals.framework.service.ICacheService;
import com.mortals.framework.util.HttpUtil;
import com.mortals.xhx.base.system.message.MessageService;
import com.mortals.xhx.busiz.req.ApiThirdPartyReq;
import com.mortals.xhx.busiz.req.DeviceReq;
import com.mortals.xhx.busiz.rsp.ApiResp;
import com.mortals.xhx.common.code.DeviceMethodEnum;
import com.mortals.xhx.common.code.MessageTypeEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.pdu.DeviceReq;
import com.mortals.xhx.common.utils.SendTask;
import com.mortals.xhx.common.utils.SendTaskThreadPool;
import com.mortals.xhx.queue.*;
......
package com.mortals.xhx.busiz.req;
import com.mortals.xhx.common.pdu.DeviceReq;
import lombok.Data;
import java.util.List;
......
......@@ -48,5 +48,10 @@ public class DeviceInfo implements Serializable {
private Integer source;
/**
* 设备调试状态 (0.停止,1.启用)
*/
private Integer debug;
}
......@@ -3,14 +3,10 @@ package com.mortals.xhx.busiz.security.filter;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.web.interceptor.BaseInterceptor;
import com.mortals.xhx.base.framework.annotation.ApiUserAuth;
import com.mortals.xhx.common.code.ApiRespCodeEnum;
import com.mortals.xhx.module.device.model.DeviceEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.web.method.HandlerMethod;
import javax.servlet.http.HttpServletRequest;
......@@ -61,13 +57,5 @@ public class ApiSubmitInterceptor extends BaseInterceptor {
String token = authTokenService.getToken(request);
if (cacheService.exists(KEY_TOKEN_API_CACHE + token)) return true;
return false;
// IUser apiUser = authTokenService.getLoginUser(request);
// if (!ObjectUtils.isEmpty(apiUser) ) {
// // authTokenService.verifyToken(apiUser);
// return true;
// }
// return false;
}
}
......@@ -27,7 +27,6 @@ import com.mortals.xhx.base.system.message.impl.MessageProducer;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.busiz.req.DeviceMsgReq;
import com.mortals.xhx.busiz.req.DeviceReq;
import com.mortals.xhx.busiz.req.UploadDeviceReq;
import com.mortals.xhx.busiz.rsp.*;
import com.mortals.xhx.common.code.*;
......@@ -36,6 +35,7 @@ import com.mortals.xhx.common.key.QueueKey;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders;
import com.mortals.xhx.common.model.MessageHeader;
import com.mortals.xhx.common.pdu.DeviceReq;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.common.utils.*;
......
......@@ -13,15 +13,16 @@ import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.framework.util.DateUtils;
import com.mortals.xhx.base.system.message.MessageService;
import com.mortals.xhx.base.system.message.impl.MessageProducer;
import com.mortals.xhx.busiz.req.DeviceReq;
import com.mortals.xhx.busiz.rsp.ApiResp;
import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.key.QueueKey;
import com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders;
import com.mortals.xhx.common.model.MessageHeader;
import com.mortals.xhx.common.pdu.DeviceReq;
import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.feign.IOfficeDeviceFeign;
import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.alarm.model.AlarmSmsSendEntity;
import com.mortals.xhx.module.alarm.model.AlarmSmsSendQuery;
......@@ -91,6 +92,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
private DirectMessageListenerContainer container;
@Autowired
private MessageService messageService;
@Autowired
private IOfficeDeviceFeign officeDeviceFeign;
@Value("${thirdPartyPath:/inter/device/deviceIn}")
private String thirdPartyPath;
......@@ -265,7 +268,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
throw new AppException("请选择需要更新大厅的设备!");
}
if(ObjectUtils.isEmpty(deviceEntity.getHallId())){
if (ObjectUtils.isEmpty(deviceEntity.getHallId())) {
throw new AppException("设备所属大厅不能为空!");
}
......@@ -358,14 +361,22 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
deviceReq.setDeviceInBuilding(entity.getDeviceInBuilding() == null ? 0 : entity.getDeviceInBuilding());
deviceReq.setDeviceInFloor(entity.getDeviceInFloor() == null ? 0 : entity.getDeviceInFloor());
//http://192.168.0.98:8090/inter/device/deviceIn
String phpInUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_IN_HTTP_URL, "http://172.15.28.116:8090");
ApiResp<String> resp = messageService.sendThirdParty(UrlBuilder.of(phpInUrl).addPath(thirdPartyPath).build(), deviceReq);
log.info("sendThirtyis resp ==>{}", JSON.toJSONString(resp));
//判断是否是php,如果不是 则是java 则内部调用
if ("smartOffice".equals(platformEntity.getPlatformSn())) {
//todo 调用智慧办公系统
Rest<String> officeRest = officeDeviceFeign.deviceCall(deviceReq);
log.info("office resp ==>{}", JSON.toJSONString(officeRest));
} else {
String phpInUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_IN_HTTP_URL, "http://172.15.28.116:8090");
ApiResp<String> resp = messageService.sendThirdParty(UrlBuilder.of(phpInUrl).addPath(thirdPartyPath).build(), deviceReq);
log.info("sendThirty resp ==>{}", JSON.toJSONString(resp));
if (resp.getCode() == YesNoEnum.YES.getValue()) {
return Rest.ok("成功!");
if (resp.getCode() == YesNoEnum.YES.getValue()) {
return Rest.ok("成功!");
}
}
return Rest.fail(resp.getMsg());
return Rest.ok();
}
@Override
......
......@@ -950,7 +950,86 @@ key|String|消息唯一标识|是|-
```
## 设备告警日志
### 查询设备告警日志列表
**请求URL:** m/device/alarm/info/list
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**简要描述:** 查询设备告警日志
**请求参数:**
参数名称| 类型 |必填|描述
:---|:--------|:---|:------
page| Integer |否|当前页
size| Integer |否|每页条数,值为-1,查询所有记录
alarmDevice| Long |否|告警设备Id
deviceName| String |否|告警设备名称
deviceCode| String |否|告警设备编码
alarmContent| String |否|告警内容
alarmType| Integer |否|告警类型,(0.离线)
alarmStatus| Integer |否|告警状态(0.未清除,1.清除未确认,2.清除已确认)
siteId| Long |否|站点Id
alarmTimeStart| String |否|开始时间
alarmTimeEnd| String |否|结束时间
**请求样例:**
```
{
"alarmDevice":2565,
"alarmType":5311,
"alarmStatus":7481,
"siteId":6279,
"page":1,
"size":10
}
```
**响应参数:**
参数名称|参数类型|描述
:---|:---|:------
code|Integer|结果码(-1.失败,1.成功)
msg|String|消息
data|object|数据对象
&emsp;per_page|Integer|每页条数
&emsp;total|Integer|总条数
&emsp;last_page|Integer|总页数
&emsp;current_page|Integer|当前页
&emsp;data|array|结果集列表|数组
&emsp;&emsp;id|Long|主键ID,主键,自增长
&emsp;&emsp;alarmTime|Date|告警时间
&emsp;&emsp;alarmDevice|Long|告警设备Id
&emsp;&emsp;alarmType|Integer|告警类型,(0.离线)
&emsp;&emsp;alarmLevel|Integer|告警级别(0.危险,1.次要,2.一般)
&emsp;&emsp;alarmReceivePersonnel|String|接收人员[设备管理的责任人]
&emsp;&emsp;receivePersonnelTelephone|String|接收人员电话
&emsp;&emsp;alarmStatus|Integer|告警状态,来自工单系统(0.未清除,1.清除未确认,2.清除已确认)
&emsp;&emsp;alarmContent|String|告警详细内容
&emsp;&emsp;createTime|Date|创建时间
&emsp;&emsp;updateUserId|Long|更新用户
&emsp;&emsp;updateTime|Date|更新时间
&emsp;&emsp;siteId|Long|站点Id,来源基础服务平台
&emsp;&emsp;deviceCode|String|设备编码
&emsp;&emsp;deviceName|String|设备名称
dict|object|字典对象
&emsp;alarmType|object|字典属性对象,详见附录
&emsp;alarmLevel|object|字典属性对象,详见附录
&emsp;alarmStatus|object|字典属性对象,详见附录
**响应消息样例:**
```
{
"code":1,
"data":{
}
}
```
## 码表
......
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