Merge branch 'feature-BOX一期' into test
This commit is contained in:
commit
dad4e20ece
@ -54,6 +54,10 @@
|
|||||||
<groupId>org.springframework.amqp</groupId>
|
<groupId>org.springframework.amqp</groupId>
|
||||||
<artifactId>spring-rabbit</artifactId>
|
<artifactId>spring-rabbit</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.data</groupId>
|
||||||
|
<artifactId>spring-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<finalName>${project.artifactId}</finalName>
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
|||||||
@ -77,7 +77,7 @@ public class SystemTalkAnswerConfigEntity extends GenericEntity<Long> {
|
|||||||
@Column(name = "play_type", nullable = false)
|
@Column(name = "play_type", nullable = false)
|
||||||
private Integer playType;
|
private Integer playType;
|
||||||
|
|
||||||
@Comment("处理Bean名字")
|
@Comment("处理Bean名字,空使用qianWenActionCommand(动词后的量词、关键字等除外200,400)")
|
||||||
@Column(name = "bean_name", nullable = false)
|
@Column(name = "bean_name", nullable = false)
|
||||||
private String beanName;
|
private String beanName;
|
||||||
|
|
||||||
|
|||||||
@ -2,9 +2,9 @@ package com.qiuguo.iot.data.service.device;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.qiuguo.iot.base.utils.StringUtils;
|
|
||||||
import com.qiuguo.iot.data.entity.device.DeviceAlarmClockRecordEntity;
|
import com.qiuguo.iot.data.entity.device.DeviceAlarmClockRecordEntity;
|
||||||
import com.qiuguo.iot.data.request.device.DeviceAlarmClockRecordRequest;
|
import com.qiuguo.iot.data.request.device.DeviceAlarmClockRecordRequest;
|
||||||
|
import com.qiuguo.iot.base.utils.StringUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.hswebframework.ezorm.core.param.Sort;
|
import org.hswebframework.ezorm.core.param.Sort;
|
||||||
import org.hswebframework.ezorm.rdb.mapping.ReactiveQuery;
|
import org.hswebframework.ezorm.rdb.mapping.ReactiveQuery;
|
||||||
|
|||||||
@ -16,9 +16,11 @@ import org.hswebframework.ezorm.rdb.operator.dml.query.SortOrder;
|
|||||||
import org.hswebframework.web.api.crud.entity.PagerResult;
|
import org.hswebframework.web.api.crud.entity.PagerResult;
|
||||||
import org.hswebframework.web.api.crud.entity.QueryParamEntity;
|
import org.hswebframework.web.api.crud.entity.QueryParamEntity;
|
||||||
import org.hswebframework.web.crud.service.GenericReactiveCrudService;
|
import org.hswebframework.web.crud.service.GenericReactiveCrudService;
|
||||||
|
import org.springframework.data.redis.core.ReactiveStringRedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -36,7 +38,8 @@ import java.util.Date;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class DeviceInfoService extends GenericReactiveCrudService<DeviceInfoEntity, Long> {
|
public class DeviceInfoService extends GenericReactiveCrudService<DeviceInfoEntity, Long> {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
ReactiveStringRedisTemplate reactiveStringRedisTemplate;
|
||||||
public Mono<DeviceInfoEntity> selectDeviceInfoByRequest(DeviceInfoRequest request){
|
public Mono<DeviceInfoEntity> selectDeviceInfoByRequest(DeviceInfoRequest request){
|
||||||
ReactiveQuery<DeviceInfoEntity> reactiveQuery = createQuery();
|
ReactiveQuery<DeviceInfoEntity> reactiveQuery = createQuery();
|
||||||
reactiveQuery = reactiveQuery.and("is_delete", 0);
|
reactiveQuery = reactiveQuery.and("is_delete", 0);
|
||||||
@ -390,4 +393,17 @@ public class DeviceInfoService extends GenericReactiveCrudService<DeviceInfoEnti
|
|||||||
.where("sn", sn)
|
.where("sn", sn)
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Mono<DeviceInfoEntity> getDeviceInfo(String sn){
|
||||||
|
DeviceInfoRequest request = new DeviceInfoRequest();
|
||||||
|
request.setSn(sn);
|
||||||
|
return selectDeviceInfoByRequest(request).defaultIfEmpty(new DeviceInfoEntity()).map(dv -> {
|
||||||
|
if(dv.getId() != null){
|
||||||
|
String redis = JSONObject.toJSONString(dv);
|
||||||
|
reactiveStringRedisTemplate.opsForValue().set(RedisConstans.DEVICE_INFO + dv.getSn(), redis, Duration.ofHours(1)).subscribe();//直接提交订阅
|
||||||
|
}
|
||||||
|
|
||||||
|
return dv;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -694,7 +694,9 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
|||||||
actions.setName("");
|
actions.setName("");
|
||||||
action.setLbs(new ArrayList<>());
|
action.setLbs(new ArrayList<>());
|
||||||
action.setAsk(actions.getRecordText());
|
action.setAsk(actions.getRecordText());
|
||||||
}
|
}/*else{
|
||||||
|
action.setSystemTalkAnswerConfigEntity(actions.getLastSystemTalkAnswerConfigEntity());
|
||||||
|
}*/
|
||||||
int index = Integer.parseInt(key.replace(">", ""));
|
int index = Integer.parseInt(key.replace(">", ""));
|
||||||
action.setDeviceUserBindEntity(includs.get(index));
|
action.setDeviceUserBindEntity(includs.get(index));
|
||||||
actions.setName("");
|
actions.setName("");
|
||||||
|
|||||||
@ -52,12 +52,15 @@ public class Actions {
|
|||||||
|
|
||||||
public void setLastSystemTalkAnswerConfigEntity(SystemTalkAnswerConfigEntity systemTalkAnswerConfigEntity){
|
public void setLastSystemTalkAnswerConfigEntity(SystemTalkAnswerConfigEntity systemTalkAnswerConfigEntity){
|
||||||
if(systemTalkAnswerConfigEntity != null){
|
if(systemTalkAnswerConfigEntity != null){
|
||||||
|
lastSystemTalkAnswerConfigEntity = systemTalkAnswerConfigEntity;
|
||||||
for(Action action : actions){
|
for(Action action : actions){
|
||||||
if(action.getSystemTalkAnswerConfigEntity() == null
|
if(action.getSystemTalkAnswerConfigEntity() == null
|
||||||
&& StringUtils.isNotEmpty(action.getName())){
|
&& StringUtils.isNotEmpty(action.getName())){
|
||||||
action.setSystemTalkAnswerConfigEntity(systemTalkAnswerConfigEntity);
|
action.setSystemTalkAnswerConfigEntity(systemTalkAnswerConfigEntity);
|
||||||
|
action.setAction(systemTalkAnswerConfigEntity.getAskKey());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,15 +24,15 @@ import com.qiuguo.iot.data.service.device.DeviceUserTalkRecordService;
|
|||||||
import com.qiuguo.iot.third.service.TuyaDeviceConnector;
|
import com.qiuguo.iot.third.service.TuyaDeviceConnector;
|
||||||
import com.qiuguo.iot.user.api.resp.device.DeviceInitResp;
|
import com.qiuguo.iot.user.api.resp.device.DeviceInitResp;
|
||||||
import com.qiuguo.iot.user.api.rest.device.SetDeviceBindInfoRest;
|
import com.qiuguo.iot.user.api.rest.device.SetDeviceBindInfoRest;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.hswebframework.web.api.crud.entity.PagerResult;
|
|
||||||
import org.hswebframework.web.exception.BusinessException;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.data.redis.core.ReactiveStringRedisTemplate;
|
import org.springframework.data.redis.core.ReactiveStringRedisTemplate;
|
||||||
import org.springframework.data.redis.core.ReactiveValueOperations;
|
import org.springframework.data.redis.core.ReactiveValueOperations;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.hswebframework.web.api.crud.entity.PagerResult;
|
||||||
|
import org.hswebframework.web.exception.BusinessException;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|||||||
@ -35,6 +35,7 @@ public class IotActionCommand extends ActionCommand implements IActionCommand{
|
|||||||
|
|
||||||
|
|
||||||
public Mono<Boolean> process(Action action, BaseSession baseSession) {
|
public Mono<Boolean> process(Action action, BaseSession baseSession) {
|
||||||
|
log.info("IOT物联网 Action:{}", action.getAsk());
|
||||||
if(StringUtils.isNotEmpty(action.getName())){
|
if(StringUtils.isNotEmpty(action.getName())){
|
||||||
if(action.getDeviceUserBindEntity() == null){
|
if(action.getDeviceUserBindEntity() == null){
|
||||||
log.info("匹配时未找到对应的设备,模糊匹配{}", action.getName());
|
log.info("匹配时未找到对应的设备,模糊匹配{}", action.getName());
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import reactor.core.publisher.Mono;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class QianWenActionCommand extends ActionCommand implements IActionCommand{
|
public class QianWenActionCommand extends ActionCommand implements IActionCommand{
|
||||||
public Mono<Boolean> process(Action action, BaseSession baseSession) {
|
public Mono<Boolean> process(Action action, BaseSession baseSession) {
|
||||||
|
log.info("千问 Action:{}", action.getAsk());
|
||||||
|
|
||||||
return toQianWen(action, baseSession, AskTypeEnum.TTS.getCode()).flatMap(vo ->{
|
return toQianWen(action, baseSession, AskTypeEnum.TTS.getCode()).flatMap(vo ->{
|
||||||
//千问只调一次
|
//千问只调一次
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import reactor.core.publisher.Mono;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class QiuGuoActionCommand extends ActionCommand implements IActionCommand{
|
public class QiuGuoActionCommand extends ActionCommand implements IActionCommand{
|
||||||
public Mono<Boolean> process(Action action, BaseSession baseSession) {
|
public Mono<Boolean> process(Action action, BaseSession baseSession) {
|
||||||
|
log.info("自定义关键词Time Action:{}", action.getAsk());
|
||||||
return baseWebSocketService.sendMessage(action,
|
return baseWebSocketService.sendMessage(action,
|
||||||
baseSession,
|
baseSession,
|
||||||
action.getSystemTalkAnswerConfigEntity().getAnswerValue(),
|
action.getSystemTalkAnswerConfigEntity().getAnswerValue(),
|
||||||
|
|||||||
@ -22,6 +22,7 @@ public class WeatherActionCommand extends ActionCommand implements IActionComma
|
|||||||
@Resource
|
@Resource
|
||||||
protected WeatherService weatherService;
|
protected WeatherService weatherService;
|
||||||
public Mono<Boolean> process(Action action, BaseSession baseSession) {
|
public Mono<Boolean> process(Action action, BaseSession baseSession) {
|
||||||
|
log.info("天气 Action:{}", action.getAsk());
|
||||||
ThirdWeatherInfoRequest req = new ThirdWeatherInfoRequest();
|
ThirdWeatherInfoRequest req = new ThirdWeatherInfoRequest();
|
||||||
//String city = "";
|
//String city = "";
|
||||||
if(action.getLbs() != null && action.getLbs().size() > 0){
|
if(action.getLbs() != null && action.getLbs().size() > 0){
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import com.qiuguo.iot.base.enums.AskTypeEnum;
|
|||||||
import com.qiuguo.iot.base.utils.Md5Utils;
|
import com.qiuguo.iot.base.utils.Md5Utils;
|
||||||
import com.qiuguo.iot.base.utils.StringUtils;
|
import com.qiuguo.iot.base.utils.StringUtils;
|
||||||
import com.qiuguo.iot.box.websocket.api.domain.box.BoxSession;
|
import com.qiuguo.iot.box.websocket.api.domain.box.BoxSession;
|
||||||
|
import com.qiuguo.iot.box.websocket.api.service.BaseWebSocketService;
|
||||||
import com.qiuguo.iot.box.websocket.api.service.WebsocketService;
|
import com.qiuguo.iot.box.websocket.api.service.WebsocketService;
|
||||||
import com.qiuguo.iot.data.entity.device.DeviceInfoEntity;
|
import com.qiuguo.iot.data.entity.device.DeviceInfoEntity;
|
||||||
import com.qiuguo.iot.data.request.device.DeviceInfoRequest;
|
import com.qiuguo.iot.data.request.device.DeviceInfoRequest;
|
||||||
@ -41,15 +42,15 @@ public class WebsocketController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
LacNlpService lacNlpService;
|
LacNlpService lacNlpService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
BaseWebSocketService baseWebSocketService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
SystemTalkAnswerConfigService systemTalkAnswerConfigService;
|
SystemTalkAnswerConfigService systemTalkAnswerConfigService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ReactiveStringRedisTemplate reactiveStringRedisTemplate;
|
private ReactiveStringRedisTemplate reactiveStringRedisTemplate;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private DeviceInfoService deviceInfoService;
|
|
||||||
|
|
||||||
@Value("${device.checkTimeout}")
|
@Value("${device.checkTimeout}")
|
||||||
private Boolean checkTimeout;
|
private Boolean checkTimeout;
|
||||||
|
|
||||||
@ -82,18 +83,7 @@ public class WebsocketController {
|
|||||||
return lacNlpService.geSingletNlp(value);
|
return lacNlpService.geSingletNlp(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Mono<DeviceInfoEntity> getDeviceInfo(String sn){
|
|
||||||
DeviceInfoRequest request = new DeviceInfoRequest();
|
|
||||||
request.setSn(sn);
|
|
||||||
return deviceInfoService.selectDeviceInfoByRequest(request).defaultIfEmpty(new DeviceInfoEntity()).map(dv -> {
|
|
||||||
if(dv.getId() != null){
|
|
||||||
String redis = JSONObject.toJSONString(dv);
|
|
||||||
reactiveStringRedisTemplate.opsForValue().set(RedisConstans.DEVICE_INFO + dv.getSn(), redis, Duration.ofHours(1)).subscribe();//直接提交订阅
|
|
||||||
}
|
|
||||||
|
|
||||||
return dv;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/tts/token")
|
@GetMapping("/tts/token")
|
||||||
public Mono<String> getTtsToken(ServerHttpRequest serverHttpRequest) {
|
public Mono<String> getTtsToken(ServerHttpRequest serverHttpRequest) {
|
||||||
@ -107,64 +97,35 @@ public class WebsocketController {
|
|||||||
log.info("设备{},请求数据已超时", sn);
|
log.info("设备{},请求数据已超时", sn);
|
||||||
return Mono.just("请求超时");
|
return Mono.just("请求超时");
|
||||||
}
|
}
|
||||||
|
return baseWebSocketService.checkBoxSignature(sn, signature, linkTime).flatMap(b -> {
|
||||||
return reactiveStringRedisTemplate.opsForValue()
|
if(b.getId() != null){
|
||||||
.get(RedisConstans.DEVICE_INFO + sn).defaultIfEmpty("")
|
return reactiveStringRedisTemplate.opsForValue()
|
||||||
.flatMap(s -> {
|
.get(RedisConstans.ALI_TTS_TOKEN).defaultIfEmpty("")
|
||||||
if(com.qiuguo.iot.base.utils.StringUtils.isNotBlank(s)){
|
.flatMap(toen -> {
|
||||||
try{
|
if(StringUtils.isNotBlank(toen)){
|
||||||
DeviceInfoEntity dv = JSONObject.parseObject(s, DeviceInfoEntity.class);
|
return Mono.just(toen);
|
||||||
if(dv.getId() == null){
|
|
||||||
log.info("redis设备缓存异常,清楚");
|
|
||||||
return getDeviceInfo(sn);
|
|
||||||
}
|
}
|
||||||
return Mono.just(dv);
|
try {
|
||||||
}catch (Exception e){
|
AccessToken accessToken = new AccessToken(aliAccessKeyId, aliAccessSecret);
|
||||||
log.info("转换异常,清除redis。下次连接成功{}", e);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
accessToken.apply();
|
||||||
|
|
||||||
}
|
String token = accessToken.getToken();
|
||||||
return getDeviceInfo(sn);
|
long expireTime = accessToken.getExpireTime() - 600000L;//提前10分钟更新
|
||||||
|
return reactiveStringRedisTemplate.opsForValue().set(RedisConstans.ALI_TTS_TOKEN,
|
||||||
}).flatMap(dv ->{
|
token, Duration.ofMillis(expireTime)).flatMap(t -> {
|
||||||
|
return Mono.just(token);
|
||||||
String signalMd5 = Md5Utils.getBoxSignal(sn, dv.getWifiMac(), dv.getBtMac(), dv.getKey(), linkTime);
|
|
||||||
if(!signalMd5.equals(signature)){
|
|
||||||
log.info("设备{},验签失败。正常签:{}", sn, signalMd5);
|
|
||||||
|
|
||||||
return Mono.just("验签失败");
|
|
||||||
}else{
|
|
||||||
log.info("设备{},验签成功", sn);
|
|
||||||
return reactiveStringRedisTemplate.opsForValue()
|
|
||||||
.get(RedisConstans.ALI_TTS_TOKEN).defaultIfEmpty("")
|
|
||||||
.flatMap(toen -> {
|
|
||||||
if(StringUtils.isNotBlank(toen)){
|
|
||||||
return Mono.just(toen);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
AccessToken accessToken = new AccessToken(aliAccessKeyId, aliAccessSecret);
|
|
||||||
|
|
||||||
|
|
||||||
accessToken.apply();
|
|
||||||
|
|
||||||
String token = accessToken.getToken();
|
|
||||||
long expireTime = accessToken.getExpireTime() - 600000L;//提前10分钟更新
|
|
||||||
//return Mono.just(token);
|
|
||||||
return reactiveStringRedisTemplate.opsForValue().set(RedisConstans.ALI_TTS_TOKEN,
|
|
||||||
token, Duration.ofMillis(expireTime)).flatMap(t -> {
|
|
||||||
return Mono.just(token);
|
|
||||||
});
|
|
||||||
|
|
||||||
}catch (Exception e){
|
|
||||||
log.info("获取阿里Token异常{}", e);
|
|
||||||
}
|
|
||||||
return Mono.just("获取token异常");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}catch (Exception e){
|
||||||
});
|
log.info("获取阿里Token异常{}", e);
|
||||||
|
}
|
||||||
|
return Mono.just("获取token异常");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return Mono.just("验签错误");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import com.qiuguo.iot.base.constans.RedisConstans;
|
|||||||
import com.qiuguo.iot.base.enums.*;
|
import com.qiuguo.iot.base.enums.*;
|
||||||
import com.qiuguo.iot.base.model.UserDeviceInfoModel;
|
import com.qiuguo.iot.base.model.UserDeviceInfoModel;
|
||||||
import com.qiuguo.iot.base.utils.Md5Utils;
|
import com.qiuguo.iot.base.utils.Md5Utils;
|
||||||
|
import com.qiuguo.iot.base.utils.StringUtils;
|
||||||
import com.qiuguo.iot.box.websocket.api.command.ActionCommand;
|
import com.qiuguo.iot.box.websocket.api.command.ActionCommand;
|
||||||
import com.qiuguo.iot.box.websocket.api.domain.BaseSession;
|
import com.qiuguo.iot.box.websocket.api.domain.BaseSession;
|
||||||
import com.qiuguo.iot.box.websocket.api.domain.box.BoxSession;
|
import com.qiuguo.iot.box.websocket.api.domain.box.BoxSession;
|
||||||
@ -107,7 +108,7 @@ public class BoxWebSocketHandler implements WebSocketHandler {
|
|||||||
|
|
||||||
|
|
||||||
//校验
|
//校验
|
||||||
checkToken(boxSession, sn, linkTime, signature, userId, isBind).contextWrite(context -> {
|
checkToken(boxSession, linkTime, signature, isBind).contextWrite(context -> {
|
||||||
Context contextTmp = context.put(LogMdcConfiguration.PRINT_LOG_ID, boxSession.getLogId());
|
Context contextTmp = context.put(LogMdcConfiguration.PRINT_LOG_ID, boxSession.getLogId());
|
||||||
|
|
||||||
return contextTmp;
|
return contextTmp;
|
||||||
@ -140,18 +141,14 @@ public class BoxWebSocketHandler implements WebSocketHandler {
|
|||||||
String text = webSocketMessage.getPayloadAsText();
|
String text = webSocketMessage.getPayloadAsText();
|
||||||
log.info("设备端收到消息:{}", text);
|
log.info("设备端收到消息:{}", text);
|
||||||
BoxTalkMessage boxTalkMessage = JSONObject.parseObject(text, BoxTalkMessage.class);
|
BoxTalkMessage boxTalkMessage = JSONObject.parseObject(text, BoxTalkMessage.class);
|
||||||
BoxSession boxSession1 = baseWebSocketService.getBoxSessionWithSn(boxTalkMessage.getSn());
|
boxTalkMessage.setSn(boxSession.getSn());
|
||||||
if(boxSession != boxSession1){
|
|
||||||
log.info("消息发送异常,或者未验签就收到信息不是同一个链接。可能传错SN");
|
|
||||||
return baseWebSocketService.closeSendMsg(boxSession, "请等待验签结束或者SN可能错误", AskTypeEnum.TTS.getCode()).flatMap(b -> {
|
|
||||||
return Mono.empty();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
log.info("收到SN:{},消息:{}", boxTalkMessage.getSn(), boxTalkMessage.getMessage());
|
log.info("收到SN:{},消息:{}", boxTalkMessage.getSn(), boxTalkMessage.getMessage());
|
||||||
return nlpService.getActionWithLacSingle(boxSession.getUserId(), boxTalkMessage.getMessage()).defaultIfEmpty(new Actions()).flatMap(actions -> {
|
return nlpService.getActionWithLacSingle(
|
||||||
|
boxSession.getUserId(),
|
||||||
|
boxTalkMessage.getMessage()
|
||||||
|
).defaultIfEmpty(new Actions()).flatMap(actions -> {
|
||||||
boxSession.setRequestId(boxSession.getRequestId() + 1);
|
boxSession.setRequestId(boxSession.getRequestId() + 1);
|
||||||
return ActionCommand.processAction(actions, boxSession);
|
return ActionCommand.processAction(actions, boxSession);
|
||||||
//return Mono.empty();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,70 +174,26 @@ public class BoxWebSocketHandler implements WebSocketHandler {
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
log.info("被踢下线断开连接:{}", boxSession.getSn());
|
log.info("下线断开连接:{}", boxSession.getSn());
|
||||||
return Mono.empty();
|
return Mono.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Mono<Void> errorLogin(BaseSession boxSession, String sn){
|
private Mono<Void> checkToken(BoxSession boxSession, Long linkTime, String signature, Integer isBind){
|
||||||
//清除异常redis
|
return baseWebSocketService.checkBoxSignature(boxSession.getSn(), signature, linkTime).flatMap(dv -> {
|
||||||
return reactiveStringRedisTemplate.opsForValue().delete(RedisConstans.DEVICE_INFO + sn).flatMap(i -> {
|
if(dv.getId() != null){
|
||||||
return baseWebSocketService.closeSendMsg(boxSession, "异常,请重新登录", AskTypeEnum.TTS.getCode());
|
boxSession.setDeviceId(dv.getId());
|
||||||
});
|
BoxSession oldBoxSession = baseWebSocketService.putBoxSession(boxSession.getSn(), boxSession);
|
||||||
|
return bindBox(boxSession, dv, boxSession.getUserId(), isBind).flatMap(db ->{
|
||||||
}
|
if(oldBoxSession != null){
|
||||||
|
return baseWebSocketService.closeSendMsg(oldBoxSession, "您在其他地方登录", AskTypeEnum.TTS.getCode());
|
||||||
private Mono<Void> checkToken(BoxSession boxSession, String sn, Long linkTime, String signature, Long userId, Integer isBind){
|
|
||||||
return reactiveStringRedisTemplate.opsForValue().get(RedisConstans.DEVICE_INFO + sn).defaultIfEmpty("").flatMap(s -> {
|
|
||||||
if(com.qiuguo.iot.base.utils.StringUtils.isNotBlank(s)){
|
|
||||||
try{
|
|
||||||
DeviceInfoEntity dv = JSONObject.parseObject(s, DeviceInfoEntity.class);
|
|
||||||
if(dv.getId() == null){
|
|
||||||
log.info("redis设备缓存异常,清楚");
|
|
||||||
return errorLogin(boxSession, sn).flatMap(v -> {
|
|
||||||
return Mono.empty();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return Mono.just(dv);
|
return Mono.empty();
|
||||||
}catch (Exception e){
|
});
|
||||||
log.info("转换异常,清除redis。下次连接成功{}", e);
|
|
||||||
|
|
||||||
return errorLogin(boxSession, sn).flatMap(v -> {
|
|
||||||
return Mono.empty();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
DeviceInfoRequest request = new DeviceInfoRequest();
|
if(boxSession != null){
|
||||||
request.setSn(sn);
|
return baseWebSocketService.closeSendMsg(boxSession, "验签失败", AskTypeEnum.TTS.getCode());
|
||||||
return deviceInfoService.selectDeviceInfoByRequest(request).defaultIfEmpty(new DeviceInfoEntity()).map(dv -> {
|
|
||||||
if(dv.getId() != null){
|
|
||||||
String redis = JSONObject.toJSONString(dv);
|
|
||||||
reactiveStringRedisTemplate.opsForValue().set(RedisConstans.DEVICE_INFO + dv.getSn(), redis, Duration.ofHours(1)).subscribe();//直接提交订阅
|
|
||||||
}
|
|
||||||
|
|
||||||
return dv;
|
|
||||||
});
|
|
||||||
}).flatMap(dv ->{
|
|
||||||
String signalMd5 = Md5Utils.getBoxSignal(sn, dv.getWifiMac(), dv.getBtMac(), dv.getKey(), linkTime);
|
|
||||||
if(!signalMd5.equals(signature)){
|
|
||||||
log.info("设备{},验签失败。正常签:{}", sn, signalMd5);
|
|
||||||
if(boxSession != null){
|
|
||||||
return baseWebSocketService.closeSendMsg(boxSession, "验签失败", AskTypeEnum.TTS.getCode());
|
|
||||||
}
|
|
||||||
return Mono.just(dv);
|
|
||||||
}else{
|
|
||||||
log.info("设备{},验签成功", sn);
|
|
||||||
return Mono.just(dv);
|
|
||||||
}
|
}
|
||||||
}).flatMap(d -> {
|
return Mono.empty();
|
||||||
DeviceInfoEntity dv = (DeviceInfoEntity)d;
|
|
||||||
boxSession.setDeviceId(dv.getId());
|
|
||||||
BoxSession oldBoxSession = baseWebSocketService.putBoxSession(sn, boxSession);
|
|
||||||
return bindBox(boxSession, dv, userId, isBind).flatMap(db ->{
|
|
||||||
if(oldBoxSession != null){
|
|
||||||
return baseWebSocketService.closeSendMsg(oldBoxSession, "您在其他地方登录", AskTypeEnum.TTS.getCode());
|
|
||||||
}
|
|
||||||
return Mono.empty();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,8 +226,6 @@ public class BoxWebSocketHandler implements WebSocketHandler {
|
|||||||
|
|
||||||
}else{
|
}else{
|
||||||
boxSession.setTtsId(entity.getTts());
|
boxSession.setTtsId(entity.getTts());
|
||||||
|
|
||||||
|
|
||||||
if(entity.getIsBind().equals(YesNo.YES.getCode())){
|
if(entity.getIsBind().equals(YesNo.YES.getCode())){
|
||||||
//通知用户端设备绑定成功
|
//通知用户端设备绑定成功
|
||||||
sendNoticeToUser(userId, "设备联网成功,设备序列号:" + dv.getSn(), AskTypeEnum.BOX_ON_LINE.getCode());
|
sendNoticeToUser(userId, "设备联网成功,设备序列号:" + dv.getSn(), AskTypeEnum.BOX_ON_LINE.getCode());
|
||||||
|
|||||||
@ -90,7 +90,7 @@ public class CustomerWebSocketHandler implements WebSocketHandler {
|
|||||||
}).then();
|
}).then();
|
||||||
|
|
||||||
|
|
||||||
checkToken(userSession, type, token, userId).contextWrite(context -> {
|
checkToken(userSession, type, token).contextWrite(context -> {
|
||||||
Context contextTmp = context.put(LogMdcConfiguration.PRINT_LOG_ID, userSession.getLogId());
|
Context contextTmp = context.put(LogMdcConfiguration.PRINT_LOG_ID, userSession.getLogId());
|
||||||
|
|
||||||
return contextTmp;
|
return contextTmp;
|
||||||
@ -115,16 +115,12 @@ public class CustomerWebSocketHandler implements WebSocketHandler {
|
|||||||
String text = webSocketMessage.getPayloadAsText();
|
String text = webSocketMessage.getPayloadAsText();
|
||||||
log.info("收到用户消息:{}", text);
|
log.info("收到用户消息:{}", text);
|
||||||
UserTalkMessage userTalkMessage = JSONObject.parseObject(text, UserTalkMessage.class);
|
UserTalkMessage userTalkMessage = JSONObject.parseObject(text, UserTalkMessage.class);
|
||||||
UserSession userSession1 = baseWebSocketService.getUserSessionWithUserId(userTalkMessage.getUserId());
|
userTalkMessage.setUserId(userSession.getUserId());
|
||||||
if(!userSession.equals(userSession1)){
|
|
||||||
log.info("消息发送异常,或者未验签就收到信息不是同一个链接。可能传错用户ID");
|
|
||||||
return baseWebSocketService.closeSendMsg(userSession, "请等待验签结束或者用户ID可能错误", AskTypeEnum.TTS.getCode()).flatMap(b -> {
|
|
||||||
return Mono.empty();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
log.info("收到用户userId:{},消息:{}", userTalkMessage.getUserId(), userTalkMessage.getMessage());
|
log.info("收到用户userId:{},消息:{}", userTalkMessage.getUserId(), userTalkMessage.getMessage());
|
||||||
return nlpService.getActionWithLacSingle(userSession.getUserId(), userTalkMessage.getMessage())
|
return nlpService.getActionWithLacSingle(
|
||||||
.defaultIfEmpty(new Actions()).flatMap(actions -> {
|
userSession.getUserId(),
|
||||||
|
userTalkMessage.getMessage()
|
||||||
|
).defaultIfEmpty(new Actions()).flatMap(actions -> {
|
||||||
//处理
|
//处理
|
||||||
userSession.setRequestId(userSession.getRequestId() + 1);
|
userSession.setRequestId(userSession.getRequestId() + 1);
|
||||||
return ActionCommand.processAction(actions, userSession);
|
return ActionCommand.processAction(actions, userSession);
|
||||||
@ -141,7 +137,7 @@ public class CustomerWebSocketHandler implements WebSocketHandler {
|
|||||||
return Mono.empty();
|
return Mono.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Mono<Void> checkToken(UserSession userSession, String type, String token, Long userId){
|
private Mono<Void> checkToken(UserSession userSession, String type, String token){
|
||||||
Map<String, String> reqHead = new HashMap<>();
|
Map<String, String> reqHead = new HashMap<>();
|
||||||
reqHead.put(HttpHeaderConstans.API_TYPE, type);
|
reqHead.put(HttpHeaderConstans.API_TYPE, type);
|
||||||
reqHead.put(HttpHeaderConstans.API_TOKEN, token);
|
reqHead.put(HttpHeaderConstans.API_TOKEN, token);
|
||||||
@ -149,12 +145,12 @@ public class CustomerWebSocketHandler implements WebSocketHandler {
|
|||||||
log.info("验签获取的数据{}", jsonObject);
|
log.info("验签获取的数据{}", jsonObject);
|
||||||
if(jsonObject.getInteger("code").equals(ResponeEnum.SUCESS.getCode())){
|
if(jsonObject.getInteger("code").equals(ResponeEnum.SUCESS.getCode())){
|
||||||
Long userId1 = jsonObject.getJSONObject("data").getLong("id");
|
Long userId1 = jsonObject.getJSONObject("data").getLong("id");
|
||||||
if(userId1.equals(userId)){
|
if(userId1.equals(userSession.getUserId())){
|
||||||
log.info("验签成功{}", userId);
|
log.info("验签成功{}", userSession.getUserId());
|
||||||
|
|
||||||
|
|
||||||
DeviceUserBindRequest request = new DeviceUserBindRequest();
|
DeviceUserBindRequest request = new DeviceUserBindRequest();
|
||||||
request.setUserId(userId);
|
request.setUserId(userSession.getUserId());
|
||||||
request.setDeviceType(DeviceTypeEnum.GUO_BOX.getCode());
|
request.setDeviceType(DeviceTypeEnum.GUO_BOX.getCode());
|
||||||
request.setIsMain(YesNo.YES.getCode());
|
request.setIsMain(YesNo.YES.getCode());
|
||||||
|
|
||||||
@ -170,7 +166,7 @@ public class CustomerWebSocketHandler implements WebSocketHandler {
|
|||||||
}else{
|
}else{
|
||||||
baseWebSocketService.normalSendMsg(userSession, "您暂未绑定果宝儿Box,快去绑定吧", AskTypeEnum.TTS.getCode());
|
baseWebSocketService.normalSendMsg(userSession, "您暂未绑定果宝儿Box,快去绑定吧", AskTypeEnum.TTS.getCode());
|
||||||
}
|
}
|
||||||
UserSession oldUserSession = baseWebSocketService.putUserSession(userId, userSession);
|
UserSession oldUserSession = baseWebSocketService.putUserSession(userSession.getUserId(), userSession);
|
||||||
|
|
||||||
if(oldUserSession != null){
|
if(oldUserSession != null){
|
||||||
return baseWebSocketService.closeSendMsg(oldUserSession, "您在其他地方登录", AskTypeEnum.TTS.getCode());
|
return baseWebSocketService.closeSendMsg(oldUserSession, "您在其他地方登录", AskTypeEnum.TTS.getCode());
|
||||||
@ -179,7 +175,7 @@ public class CustomerWebSocketHandler implements WebSocketHandler {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info("验签失败{}", userId);
|
log.info("验签失败{}", userSession.getUserId());
|
||||||
return baseWebSocketService.closeSendMsg(userSession, "非法登录", AskTypeEnum.TTS.getCode()).flatMap(b -> {
|
return baseWebSocketService.closeSendMsg(userSession, "非法登录", AskTypeEnum.TTS.getCode()).flatMap(b -> {
|
||||||
return Mono.empty();
|
return Mono.empty();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,25 +1,34 @@
|
|||||||
package com.qiuguo.iot.box.websocket.api.service;
|
package com.qiuguo.iot.box.websocket.api.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.nls.client.AccessToken;
|
||||||
|
import com.qiuguo.iot.base.constans.RedisConstans;
|
||||||
import com.qiuguo.iot.base.enums.AskTypeEnum;
|
import com.qiuguo.iot.base.enums.AskTypeEnum;
|
||||||
import com.qiuguo.iot.base.enums.YesNo;
|
import com.qiuguo.iot.base.enums.YesNo;
|
||||||
|
import com.qiuguo.iot.base.utils.Md5Utils;
|
||||||
import com.qiuguo.iot.base.utils.StringUtils;
|
import com.qiuguo.iot.base.utils.StringUtils;
|
||||||
import com.qiuguo.iot.box.websocket.api.domain.BaseMessageResp;
|
import com.qiuguo.iot.box.websocket.api.domain.BaseMessageResp;
|
||||||
import com.qiuguo.iot.box.websocket.api.domain.BaseSession;
|
import com.qiuguo.iot.box.websocket.api.domain.BaseSession;
|
||||||
import com.qiuguo.iot.box.websocket.api.domain.box.BoxSession;
|
import com.qiuguo.iot.box.websocket.api.domain.box.BoxSession;
|
||||||
import com.qiuguo.iot.box.websocket.api.domain.box.resp.BoxMessageResp;
|
import com.qiuguo.iot.box.websocket.api.domain.box.resp.BoxMessageResp;
|
||||||
import com.qiuguo.iot.box.websocket.api.domain.user.UserSession;
|
import com.qiuguo.iot.box.websocket.api.domain.user.UserSession;
|
||||||
|
import com.qiuguo.iot.data.entity.device.DeviceInfoEntity;
|
||||||
import com.qiuguo.iot.data.entity.device.DeviceUserTalkRecordEntity;
|
import com.qiuguo.iot.data.entity.device.DeviceUserTalkRecordEntity;
|
||||||
|
import com.qiuguo.iot.data.request.device.DeviceInfoRequest;
|
||||||
|
import com.qiuguo.iot.data.service.device.DeviceInfoService;
|
||||||
import com.qiuguo.iot.data.service.device.DeviceUserTalkRecordService;
|
import com.qiuguo.iot.data.service.device.DeviceUserTalkRecordService;
|
||||||
import com.qiuguo.iot.third.nlp.action.Action;
|
import com.qiuguo.iot.third.nlp.action.Action;
|
||||||
import com.qiuguo.iot.third.service.AudioService;
|
import com.qiuguo.iot.third.service.AudioService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.data.redis.core.ReactiveStringRedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.time.Duration;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -37,12 +46,20 @@ public class BaseWebSocketService {
|
|||||||
@Resource
|
@Resource
|
||||||
AudioService audioService;
|
AudioService audioService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
DeviceInfoService deviceInfoService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
protected DeviceUserTalkRecordService deviceUserTalkRecordService;
|
protected DeviceUserTalkRecordService deviceUserTalkRecordService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReactiveStringRedisTemplate reactiveStringRedisTemplate;
|
||||||
|
|
||||||
protected static int ONE_MAX_TEXT = 30;
|
protected static int ONE_MAX_TEXT = 30;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public BoxSession getBoxSessionWithSn(String sn) {
|
public BoxSession getBoxSessionWithSn(String sn) {
|
||||||
if(boxGroup.containsKey(sn)){
|
if(boxGroup.containsKey(sn)){
|
||||||
return boxGroup.get(sn);
|
return boxGroup.get(sn);
|
||||||
@ -200,6 +217,14 @@ public class BaseWebSocketService {
|
|||||||
//标点符号起始会导致合成的声音第一句话有杂音
|
//标点符号起始会导致合成的声音第一句话有杂音
|
||||||
text = text.substring(1);
|
text = text.substring(1);
|
||||||
}
|
}
|
||||||
|
if(text.endsWith(",") ||
|
||||||
|
text.endsWith("。") ||
|
||||||
|
text.endsWith(":") ||
|
||||||
|
text.endsWith(";") ||
|
||||||
|
text.endsWith("《") ||
|
||||||
|
text.endsWith(" ")){
|
||||||
|
text = text.substring(0, text.length() - 1);
|
||||||
|
}
|
||||||
if(text.length() > ONE_MAX_TEXT){
|
if(text.length() > ONE_MAX_TEXT){
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
sendAudioMessage(baseSession,
|
sendAudioMessage(baseSession,
|
||||||
@ -212,6 +237,7 @@ public class BaseWebSocketService {
|
|||||||
}else{
|
}else{
|
||||||
BoxMessageResp boxMessageResp = new BoxMessageResp();
|
BoxMessageResp boxMessageResp = new BoxMessageResp();
|
||||||
BeanUtils.copyProperties(baseMessageResp, boxMessageResp);
|
BeanUtils.copyProperties(baseMessageResp, boxMessageResp);
|
||||||
|
boxMessageResp.setText(text);
|
||||||
sendAudioMessage(baseSession, boxMessageResp).subscribe();
|
sendAudioMessage(baseSession, boxMessageResp).subscribe();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -305,4 +331,37 @@ public class BaseWebSocketService {
|
|||||||
return s;
|
return s;
|
||||||
});//.subscribeOn(Schedulers.single()).subscribe();
|
});//.subscribeOn(Schedulers.single()).subscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Mono<DeviceInfoEntity> checkBoxSignature(String sn, String signature, Long linkTime){
|
||||||
|
return reactiveStringRedisTemplate.opsForValue()
|
||||||
|
.get(RedisConstans.DEVICE_INFO + sn).defaultIfEmpty("")
|
||||||
|
.flatMap(s -> {
|
||||||
|
if(StringUtils.isNotBlank(s)){
|
||||||
|
try{
|
||||||
|
DeviceInfoEntity dv = JSONObject.parseObject(s, DeviceInfoEntity.class);
|
||||||
|
if(dv.getId() != null){
|
||||||
|
return Mono.just(dv);
|
||||||
|
}
|
||||||
|
log.info("redis设备缓存异常,清楚");
|
||||||
|
}catch (Exception e){
|
||||||
|
log.info("转换异常,清除redis。下次连接成功{}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return deviceInfoService.getDeviceInfo(sn);
|
||||||
|
}).map(dv ->{
|
||||||
|
if(dv.getId() != null){
|
||||||
|
String signalMd5 = Md5Utils.getBoxSignal(sn, dv.getWifiMac(), dv.getBtMac(), dv.getKey(), linkTime);
|
||||||
|
if(!signalMd5.equals(signature)){
|
||||||
|
log.info("设备{},验签失败。正常签:{}", sn, signalMd5);
|
||||||
|
return new DeviceInfoEntity();
|
||||||
|
}else{
|
||||||
|
log.info("设备{},验签成功", sn);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
log.info("设备不存在{}", sn);
|
||||||
|
}
|
||||||
|
return dv;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,7 @@ qiuguo:
|
|||||||
checktoken:
|
checktoken:
|
||||||
url: https://qiuguo-app.pre.qiuguojihua.com/pre-api/user/user/getUser
|
url: https://qiuguo-app.pre.qiuguojihua.com/pre-api/user/user/getUser
|
||||||
tts:
|
tts:
|
||||||
suanfa: true
|
suanfa: false
|
||||||
url: http://192.168.8.211:18000/run/predict #算法语音合成
|
url: http://192.168.8.211:18000/run/predict #算法语音合成
|
||||||
downurl: http://192.168.8.211:8880 #算法语音合成后资源下载路径前缀
|
downurl: http://192.168.8.211:8880 #算法语音合成后资源下载路径前缀
|
||||||
lac:
|
lac:
|
||||||
|
|||||||
@ -125,8 +125,11 @@ public class MysqlUtilTable2Contoller {
|
|||||||
List<FieldBean> list = tableBean.getFieldList();
|
List<FieldBean> list = tableBean.getFieldList();
|
||||||
try {
|
try {
|
||||||
String content = "package com.admin.service.impl;\n\n\n\n" +
|
String content = "package com.admin.service.impl;\n\n\n\n" +
|
||||||
"import org.apache.commons.lang3.StringUtils;\n" +
|
"import java.util.Date;\n" +
|
||||||
"import java.util.Date;\n";
|
"import reactor.core.publisher.Mono;\n" +
|
||||||
|
"import lombok.extern.slf4j.Slf4j;\n" +
|
||||||
|
"import org.hswebframework.web.api.crud.entity.PagerResult;\n" +
|
||||||
|
"import org.hswebframework.web.exception.BusinessException;\n";
|
||||||
|
|
||||||
|
|
||||||
content += "/**\n";
|
content += "/**\n";
|
||||||
|
|||||||
@ -31,6 +31,19 @@ public class MysqlUtilTable2Service {
|
|||||||
List<FieldBean> list = tableBean.getFieldList();
|
List<FieldBean> list = tableBean.getFieldList();
|
||||||
try {
|
try {
|
||||||
String content = "package com.admin.service.impl;\n\n\n\n" +
|
String content = "package com.admin.service.impl;\n\n\n\n" +
|
||||||
|
"import java.util.Date;\n" + "import com.qiuguo.iot.base.utils.StringUtils;\n" +
|
||||||
|
"import lombok.extern.slf4j.Slf4j;\n" +
|
||||||
|
"import org.hswebframework.ezorm.core.param.Sort;\n" +
|
||||||
|
"import org.hswebframework.ezorm.rdb.mapping.ReactiveQuery;\n" +
|
||||||
|
"import org.hswebframework.ezorm.rdb.mapping.ReactiveUpdate;\n" +
|
||||||
|
"import org.hswebframework.ezorm.rdb.operator.dml.query.SortOrder;\n" +
|
||||||
|
"import org.hswebframework.web.api.crud.entity.PagerResult;\n" +
|
||||||
|
"import org.hswebframework.web.api.crud.entity.QueryParamEntity;\n" +
|
||||||
|
"import org.hswebframework.web.crud.service.GenericReactiveCrudService;\n" +
|
||||||
|
"import org.springframework.stereotype.Service;\n" +
|
||||||
|
"import reactor.core.publisher.Mono;\n" +
|
||||||
|
"\n" +
|
||||||
|
"import java.util.Arrays;\n" +
|
||||||
"import java.util.Date;\n";
|
"import java.util.Date;\n";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -39,12 +39,6 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>ch.qos.logback</groupId>
|
|
||||||
<artifactId>logback-classic</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
<version>${spring.cloud.version}</version>
|
<version>${spring.cloud.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -56,12 +50,6 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
|
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>ch.qos.logback</groupId>
|
|
||||||
<artifactId>logback-classic</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
<version>${redis.boot.reactor.version}</version>
|
<version>${redis.boot.reactor.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -69,24 +57,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>ch.qos.logback</groupId>
|
|
||||||
<artifactId>logback-classic</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 下面都是響應式數據庫相關 r2dbc啓動類-->
|
<!-- 下面都是響應式數據庫相關 r2dbc啓動類-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-r2dbc</artifactId>
|
<artifactId>spring-boot-starter-data-r2dbc</artifactId>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>ch.qos.logback</groupId>
|
|
||||||
<artifactId>logback-classic</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
<version>${spring.boot.version}</version>
|
<version>${spring.boot.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- ORM工具,數據 -->
|
<!-- ORM工具,數據 -->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user