修改网关\user端口
This commit is contained in:
parent
fb0c57d2b2
commit
e6ddf288d1
@ -0,0 +1,26 @@
|
||||
package com.qiuguo.iot.base.enums;
|
||||
|
||||
/*
|
||||
* 响应码
|
||||
* 作者:吴林
|
||||
* */
|
||||
// 0:否 1:是
|
||||
public enum ResponeEnum {
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
SUCESS(200),//
|
||||
/**
|
||||
* 错误
|
||||
*/
|
||||
ERROR(500),//删除
|
||||
;
|
||||
ResponeEnum(Integer c){
|
||||
code = c;
|
||||
}
|
||||
private Integer code;
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
}
|
||||
@ -40,8 +40,9 @@ public class MqService {
|
||||
}
|
||||
|
||||
public Mono<Boolean> sendMessageWithConfirmation(String exchange, String routingKey, Object message) {
|
||||
rabbitTemplate.convertAndSend(exchange, routingKey, message);
|
||||
return Mono.defer(() -> {
|
||||
rabbitTemplate.convertAndSend(exchange, routingKey, message);
|
||||
|
||||
boolean result = confirmationResult.get();
|
||||
log.info("MQ消息发送:{}", result);
|
||||
return Mono.just(result);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
server:
|
||||
port: 8082
|
||||
port: 8080
|
||||
spring:
|
||||
profiles:
|
||||
# 环境配置
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
server:
|
||||
port: 8081
|
||||
port: 8080
|
||||
spring:
|
||||
application:
|
||||
name: qiuguo-iot-box-user-api
|
||||
@ -204,9 +204,10 @@ public class BaseWebSocketProcess {
|
||||
log.info("通知U3DMQ:{}", msg);
|
||||
try{
|
||||
//发送消息到MQ,通知U3D
|
||||
return mqService.sendMessageWithConfirmation(YunxiRabbitConst.EXCHANGE_YUNXI_EVENT,
|
||||
return mqService.sendMessageWithConfirmation(YunxiRabbitConst.EXCHANGE_YUNXI_EVENT,
|
||||
YunxiRabbitConst.ROUTE_KEY_YUNXI,
|
||||
msg);
|
||||
|
||||
}catch (Exception e){
|
||||
log.info("通知U3D MQ异常{}", e);
|
||||
}
|
||||
@ -454,7 +455,7 @@ public class BaseWebSocketProcess {
|
||||
return sendMessage(action, baseSession, resp);
|
||||
}else{
|
||||
//推送MQ换装
|
||||
toU3DMq(systemTalkBindU3d, baseSession.getUserId());
|
||||
|
||||
DeviceUserTalkRecordEntity talkRecord = new DeviceUserTalkRecordEntity();
|
||||
talkRecord.setAskType(AskTypeEnum.U3D.getCode());
|
||||
talkRecord.setAskValue(action.getAsk());
|
||||
@ -463,7 +464,8 @@ public class BaseWebSocketProcess {
|
||||
talkRecord.setUserId(baseSession.getUserId());
|
||||
talkRecord.setDeviceId(baseSession.getDeviceId());
|
||||
return deviceUserTalkRecordService.insertDeviceUserTalkRecord(talkRecord).flatMap(integer -> {
|
||||
return Mono.just(true);
|
||||
return toU3DMq(systemTalkBindU3d, baseSession.getUserId());
|
||||
//return Mono.just(true);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.qiuguo.iot.base.annotation.WebSocketMapping;
|
||||
import com.qiuguo.iot.base.enums.AskTypeEnum;
|
||||
import com.qiuguo.iot.base.enums.DeviceTypeEnum;
|
||||
import com.qiuguo.iot.base.enums.ResponeEnum;
|
||||
import com.qiuguo.iot.base.enums.YesNo;
|
||||
import com.qiuguo.iot.base.utils.WebClientUtils;
|
||||
import com.qiuguo.iot.box.websocket.api.domain.BaseSession;
|
||||
@ -140,7 +141,7 @@ public class CustomerWebSocketHandler extends BaseWebSocketProcess implements We
|
||||
reqHead.put(apiToken, token);
|
||||
return WebClientUtils.get(checkTokenUrl, reqHead).defaultIfEmpty(new JSONObject()).flatMap(jsonObject -> {
|
||||
log.info("验签获取的数据{}", jsonObject);
|
||||
if(jsonObject.getInteger("code").equals(YesNo.YES.getCode())){
|
||||
if(jsonObject.getInteger("code").equals(ResponeEnum.SUCESS.getCode())){
|
||||
Long userId1 = jsonObject.getJSONObject("data").getLong("id");
|
||||
if(userId1.equals(userId)){
|
||||
log.info("验签成功{}", userId);
|
||||
|
||||
@ -39,7 +39,7 @@ tianqiapi:
|
||||
url: https://v0.yiketianqi.com/api?unescape=1&version=v91&appid=23293151&appsecret=Lj6ZMcqn&ext=life
|
||||
qiuguo:
|
||||
checktoken:
|
||||
url: https://exper.qiuguojihua.com/data/api.auth.center/get
|
||||
url: https://qiuguo-app.pre.qiuguojihua.com/pre-api/user/user/getUser
|
||||
tts:
|
||||
suanfa: true
|
||||
lac:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user