群机器人聊天增加请求id
This commit is contained in:
parent
85b91c7531
commit
3557fa9a31
@ -68,4 +68,9 @@ public class BaseSession {
|
||||
* 语言
|
||||
*/
|
||||
private Integer language = LanguageEnum.CHINESE.getCode();
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
protected String nickName;
|
||||
}
|
||||
|
||||
@ -18,4 +18,9 @@ public class UserTalkRequst {
|
||||
* 提问内容
|
||||
*/
|
||||
String ask;
|
||||
|
||||
/**
|
||||
* 请求时间戳,该用户想下面的请求id
|
||||
*/
|
||||
Long timeTemp;
|
||||
}
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
package com.qiuguo.iot.data.service;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import org.hswebframework.ezorm.rdb.metadata.RDBColumnMetadata;
|
||||
import org.hswebframework.ezorm.rdb.operator.builder.fragments.EmptySqlFragments;
|
||||
import org.hswebframework.ezorm.rdb.operator.builder.fragments.PrepareSqlFragments;
|
||||
import org.hswebframework.ezorm.rdb.operator.builder.fragments.SqlFragments;
|
||||
import org.hswebframework.ezorm.rdb.operator.builder.fragments.function.FunctionFragmentBuilder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public class RandFunction implements FunctionFragmentBuilder {
|
||||
private final String function;
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public SqlFragments create(String columnFullName, RDBColumnMetadata metadata, Map<String, Object> opts) {
|
||||
if (opts != null) {
|
||||
String arg = String.valueOf(opts.get("arg"));
|
||||
if ("1".equals(arg)) {
|
||||
columnFullName = arg;
|
||||
} else if (Boolean.TRUE.equals(opts.get("distinct"))) {
|
||||
columnFullName = "distinct " + columnFullName;
|
||||
}
|
||||
}
|
||||
if (columnFullName == null) {
|
||||
return EmptySqlFragments.INSTANCE;
|
||||
}
|
||||
return PrepareSqlFragments
|
||||
.of()
|
||||
.addSql(function.concat("(").concat(columnFullName).concat(")"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -5,13 +5,16 @@ import com.qiuguo.iot.base.enums.AskTypeEnum;
|
||||
import com.qiuguo.iot.base.enums.KeyTypeEnum;
|
||||
import com.qiuguo.iot.base.utils.StringUtils;
|
||||
import com.qiuguo.iot.data.entity.system.SystemTalkAnswerConfigEntity;
|
||||
import com.qiuguo.iot.data.service.RandFunction;
|
||||
import com.qiuguo.iot.data.model.system.SystemTalkAnswerConfig;
|
||||
import com.qiuguo.iot.data.model.system.SystemTalkKeyAndDeviceName;
|
||||
import com.qiuguo.iot.data.request.system.SystemTalkAnswerConfigRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.hswebframework.ezorm.core.FeatureId;
|
||||
import org.hswebframework.ezorm.core.param.Sort;
|
||||
import org.hswebframework.ezorm.rdb.mapping.ReactiveQuery;
|
||||
import org.hswebframework.ezorm.rdb.mapping.ReactiveUpdate;
|
||||
import org.hswebframework.ezorm.rdb.operator.builder.fragments.function.FunctionFragmentBuilder;
|
||||
import org.hswebframework.ezorm.rdb.operator.dml.query.SortOrder;
|
||||
import org.hswebframework.web.api.crud.entity.PagerResult;
|
||||
import org.hswebframework.web.api.crud.entity.QueryParamEntity;
|
||||
@ -53,6 +56,7 @@ public class SystemTalkAnswerConfigService extends GenericReactiveCrudService<Sy
|
||||
|
||||
private List<SystemTalkKeyAndDeviceName> commandList = new ArrayList<>();
|
||||
|
||||
RandFunction randFunction = new RandFunction("RAND", "随机");
|
||||
|
||||
@PostConstruct
|
||||
public void initGroup() {
|
||||
@ -387,7 +391,16 @@ public class SystemTalkAnswerConfigService extends GenericReactiveCrudService<Sy
|
||||
public Mono<SystemTalkAnswerConfigEntity> selectSystemTalkAnswerConfigByRand() {
|
||||
ReactiveQuery<SystemTalkAnswerConfigEntity> reactiveQuery = createQuery();
|
||||
reactiveQuery = reactiveQuery.and("is_delete", 0);
|
||||
QueryParamEntity param = QueryParamEntity.of(reactiveQuery.getParam());
|
||||
SortOrder sortOrder = new SortOrder();
|
||||
|
||||
sortOrder.setColumn("");
|
||||
sortOrder.setFunction(randFunction.getFunction());
|
||||
reactiveQuery.orderBy(sortOrder);
|
||||
Sort sort = new Sort();
|
||||
FunctionFragmentBuilder.createFeatureId(randFunction.getFunction());
|
||||
return reactiveQuery.fetchOne();
|
||||
/*QueryParamEntity param = QueryParamEntity.of(reactiveQuery.getParam());
|
||||
RandFunction randFunction = new RandFunction("rand", "随机");
|
||||
Sort sort = new Sort();
|
||||
sort.setName("RAND()");
|
||||
sort.setType("RAND()");
|
||||
@ -399,7 +412,7 @@ public class SystemTalkAnswerConfigService extends GenericReactiveCrudService<Sy
|
||||
|
||||
return data.flatMap(r ->
|
||||
Mono.just(r.getData().get(0))
|
||||
);
|
||||
);*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,6 +172,7 @@ public abstract class ActionCommand {
|
||||
//调用星尘
|
||||
tongYiCommunicationRest.setOnlyId(baseSession.getUserId().toString());
|
||||
tongYiCommunicationRest.setRoleId(baseSession.getRoleId());
|
||||
tongYiCommunicationRest.setNickName(baseSession.getNickName());
|
||||
}else{
|
||||
if(baseSession instanceof BoxSession){
|
||||
tongYiCommunicationRest.setOnlyId(baseSession.getSn());
|
||||
|
||||
@ -103,7 +103,7 @@ public class NlpService {
|
||||
}*/
|
||||
}
|
||||
}
|
||||
if(!isFinding){
|
||||
if(!isFinding && !isEng){
|
||||
HanyuPinyinOutputFormat hanyuPinyinOutputFormat = new HanyuPinyinOutputFormat();
|
||||
hanyuPinyinOutputFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
|
||||
try {
|
||||
|
||||
@ -81,7 +81,9 @@ public class DeviceController {
|
||||
.flatMap(actions -> {
|
||||
BaseSession session = new BaseSession();
|
||||
session.setUserId(userTalkRequst.getId());
|
||||
session.setNickName(userTalkRequst.getNickName());
|
||||
session.setRoleId(DeviceCodeEnum.BOX.getName());
|
||||
session.setRequestId(userTalkRequst.getTimeTemp());
|
||||
BaseMessageResp baseMessageResp = new BaseMessageResp();
|
||||
return ActionCommand.processAction(actions, session, new IActionSendMessage() {
|
||||
@Override
|
||||
|
||||
@ -130,6 +130,8 @@ public class CustomerWebSocketHandler implements WebSocketHandler {
|
||||
userSession.setLanguage(actions.getLanguage());
|
||||
userSession.setRequestId(userSession.getRequestId() + 1);
|
||||
return ActionCommand.processAction(actions, userSession, baseWebSocketService);
|
||||
}).flatMap(b -> {
|
||||
return Mono.empty();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user