diff --git a/docker/modules/user/deploy/deploy.yaml b/docker/modules/user/deploy/deploy.yaml index 665f81c..4880760 100644 --- a/docker/modules/user/deploy/deploy.yaml +++ b/docker/modules/user/deploy/deploy.yaml @@ -24,14 +24,14 @@ spec: imagePullSecrets: - name: aliyun-hub-register #提前在项目下配置访问阿里云的账号密码 containers: - - image: $REGISTRY/$DOCKERHUB_NAMESPACE/qiuguo-iot:iot-box-user-api-SNAPSHOT-v$BUILD_NUMBER + - image: $REGISTRY/$DOCKERHUB_NAMESPACE/qiuguo-iot:iot-box-user-api-SNAPSHOT-v1.0.0 readinessProbe: httpGet: path: /actuator/health port: 8080 - timeoutSeconds: 30 - failureThreshold: 120 - periodSeconds: 10 + timeoutSeconds: 10 + failureThreshold: 30 + periodSeconds: 5 imagePullPolicy: Always name: app ports: @@ -45,7 +45,7 @@ spec: terminationMessagePolicy: File dnsPolicy: ClusterFirst restartPolicy: Always - terminationGracePeriodSeconds: 120 + terminationGracePeriodSeconds: 30 --- apiVersion: v1 kind: Service diff --git a/docker/modules/user/dockerfile_test b/docker/modules/user/dockerfile_test new file mode 100644 index 0000000..d0a4e3e --- /dev/null +++ b/docker/modules/user/dockerfile_test @@ -0,0 +1,16 @@ +# 基础镜像 +FROM openjdk:8-jre +# author +MAINTAINER qiuguo + +# 挂载目录 +VOLUME /home/qiuguo +# 创建目录 +RUN mkdir -p /home/qiuguo +# 指定路径 +WORKDIR /home/qiuguo +# 复制jar文件到路径 +COPY ./jar/iot-box-user-api.jar /home/qiuguo/iot-box-user-api.jar +# 启动网关服务 +#ENTRYPOINT ["java","-jar","iot-box-user-api.jar"] +CMD ["sh","-c", "java -jar iot-box-user-api.jar --spring.profiles.active=test"] diff --git a/docker/modules/websocket/deploy/deploy.yaml b/docker/modules/websocket/deploy/deploy.yaml index eb559ba..1f67ca3 100644 --- a/docker/modules/websocket/deploy/deploy.yaml +++ b/docker/modules/websocket/deploy/deploy.yaml @@ -24,14 +24,14 @@ spec: imagePullSecrets: - name: aliyun-hub-register #提前在项目下配置访问阿里云的账号密码 containers: - - image: $REGISTRY/$DOCKERHUB_NAMESPACE/qiuguo-iot:iot-box-websocket-api-SNAPSHOT-v$BUILD_NUMBER + - image: $REGISTRY/$DOCKERHUB_NAMESPACE/qiuguo-iot:iot-box-websocket-api-SNAPSHOT-v1.0.0 readinessProbe: httpGet: path: /actuator/health port: 8080 - timeoutSeconds: 30 - failureThreshold: 120 - periodSeconds: 15 + timeoutSeconds: 10 + failureThreshold: 30 + periodSeconds: 5 imagePullPolicy: Always name: app ports: @@ -45,7 +45,7 @@ spec: terminationMessagePolicy: File dnsPolicy: ClusterFirst restartPolicy: Always - terminationGracePeriodSeconds: 120 + terminationGracePeriodSeconds: 30 --- apiVersion: v1 kind: Service diff --git a/docker/modules/websocket/dockerfile_test b/docker/modules/websocket/dockerfile_test new file mode 100644 index 0000000..083e5ef --- /dev/null +++ b/docker/modules/websocket/dockerfile_test @@ -0,0 +1,16 @@ +# 基础镜像 +FROM openjdk:8-jre +# author +MAINTAINER qiuguo + +# 挂载目录 +VOLUME /home/qiuguo +# 创建目录 +RUN mkdir -p /home/qiuguo +# 指定路径 +WORKDIR /home/qiuguo +# 复制jar文件到路径 +COPY ./jar/iot-box-websocket-api.jar /home/qiuguo/iot-box-websocket-api.jar +# 启动网关服务 +#ENTRYPOINT ["java","-jar","iot-box-websocket-api.jar"] +CMD ["sh","-c", "java -jar iot-box-websocket-api.jar --spring.profiles.active=test"] diff --git a/docker/qiuguo/gateway/deploy/deploy.yaml b/docker/qiuguo/gateway/deploy/deploy.yaml index ff75d02..38ab19d 100644 --- a/docker/qiuguo/gateway/deploy/deploy.yaml +++ b/docker/qiuguo/gateway/deploy/deploy.yaml @@ -24,7 +24,7 @@ spec: imagePullSecrets: - name: aliyun-hub-register #提前在项目下配置访问阿里云的账号密码 containers: - - image: $REGISTRY/$DOCKERHUB_NAMESPACE/qiuguo-iot:iot-gateway-SNAPSHOT-v$BUILD_NUMBER + - image: $REGISTRY/$DOCKERHUB_NAMESPACE/qiuguo-iot:iot-gateway-SNAPSHOT-v1.0.0 readinessProbe: httpGet: path: /actuator/health diff --git a/docker/qiuguo/gateway/dockerfile_test b/docker/qiuguo/gateway/dockerfile_test new file mode 100644 index 0000000..516cdd3 --- /dev/null +++ b/docker/qiuguo/gateway/dockerfile_test @@ -0,0 +1,16 @@ +# 基础镜像 +FROM openjdk:8-jre +# author +MAINTAINER qiuguo + +# 挂载目录 +VOLUME /home/qiuguo +# 创建目录 +RUN mkdir -p /home/qiuguo +# 指定路径 +WORKDIR /home/qiuguo +# 复制jar文件到路径 +COPY ./jar/iot-gateway.jar /home/qiuguo/iot-gateway.jar +# 启动网关服务 +#ENTRYPOINT ["java","-jar","iot-gateway.jar"] +CMD ["sh","-c", "java -jar iot-gateway.jar --spring.profiles.active=test"] diff --git a/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/AskTypeEnum.java b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/AskTypeEnum.java index e4c1c22..b7e91db 100644 --- a/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/AskTypeEnum.java +++ b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/AskTypeEnum.java @@ -23,6 +23,7 @@ public enum AskTypeEnum { DEVICE_BIND(104, "设备绑定成功"), COMMAND_N(200, "指令后必须跟的名称词"), QIU_GUO(300, "秋果专有名词"), + USER_CONFIG(301, "根据用户编号回答不同"), IGNORE(400, "^^^"),//全部、所有、一切等忽略此 ; AskTypeEnum(Integer c, String n){ diff --git a/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/entity/system/SystemTalkAnswerConfigEntity.java b/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/entity/system/SystemTalkAnswerConfigEntity.java index 79ce2eb..d7db07f 100644 --- a/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/entity/system/SystemTalkAnswerConfigEntity.java +++ b/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/entity/system/SystemTalkAnswerConfigEntity.java @@ -69,7 +69,7 @@ public class SystemTalkAnswerConfigEntity extends GenericEntity { @Column(name = "key_order", nullable = false) private Long keyOrder; - @Comment("回答类型0:文本问答 1:iOT控制 2:天气 3:闹钟 4:U3D 5:音乐声音 6:询问时间 7:古诗、诗歌、诗 100:固件升级 101:Box上线 200:动作后必须跟的名称词 300秋果专有名词 400:全部,所有,一切忽略词") + @Comment("回答类型0:文本问答 1:iOT控制 2:天气 3:闹钟 4:U3D 5:音乐声音 6:询问时间 7:古诗、诗歌、诗 100:固件升级 101:Box上线 200:动作后必须跟的名称词 300秋果专有名词 301:根据用户编号回答不同 400:全部,所有,一切忽略词") @Column(name = "answer_type", nullable = false) private Integer answerType; diff --git a/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/entity/system/SystemTalkBindUserEntity.java b/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/entity/system/SystemTalkBindUserEntity.java new file mode 100644 index 0000000..ee56a7e --- /dev/null +++ b/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/entity/system/SystemTalkBindUserEntity.java @@ -0,0 +1,76 @@ +package com.qiuguo.iot.data.entity.system; +import org.hswebframework.ezorm.rdb.mapping.annotation.Comment; +import org.hswebframework.web.crud.annotation.EnableEntityEvent; +import org.hswebframework.web.api.crud.entity.GenericEntity; +import javax.persistence.Column; +import javax.persistence.Table;import lombok.Data; +import java.util.Date; +/** +*

+*

*系统问答和用户绑定关系 +* @author wulin +* @since 2023-10-23 +*/ + +@Data +@Comment("系统问答和用户绑定关系") +@Table(name = "system_talk_bind_user") +@EnableEntityEvent +public class SystemTalkBindUserEntity extends GenericEntity { + @Comment("id") + @Column(name = "id", length = 11, nullable = false, unique = true) + private Long id; + + @Comment("是否删除:0 否 1 删除") + @Column(name = "is_delete", nullable = false) + private Integer isDelete; + + @Comment("创建时间") + @Column(name = "create_time") + private Date createTime; + + @Comment("修改时间") + @Column(name = "modify_time") + private Date modifyTime; + + @Comment("自定义命令id") + @Column(name = "system_talk_id", nullable = false) + private Long systemTalkId; + + @Comment("用户ID") + @Column(name = "user_id", nullable = false) + private Long userId; + + @Comment("动作后的变量,名词") + @Column(name = "ask_common", length = 255) + private String askCommon; + + @Comment("成功回答内容(传给box)") + @Column(name = "answer_value", length = 255) + private String answerValue; + + @Comment("执行失败回答内容") + @Column(name = "answer_value_faild", length = 255) + private String answerValueFaild; + + @Comment("回答时的动作(数字人的口型以外动作)") + @Column(name = "answer_action", length = 255) + private String answerAction; + + @Comment("执行失败所对应动作") + @Column(name = "answer_action_faild", length = 255) + private String answerActionFaild; + + @Comment("回答时的背景音乐(URL)") + @Column(name = "answer_back_sound", length = 255) + private String answerBackSound; + + @Comment("回答时的背景图片、视屏、动画(URL)") + @Column(name = "answer_back_img", length = 255) + private String answerBackImg; + + @Comment("备注") + @Column(name = "remark", length = 255) + private String remark; + +} \ No newline at end of file diff --git a/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/request/system/SystemTalkAnswerConfigRequest.java b/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/request/system/SystemTalkAnswerConfigRequest.java index 9e90ddc..664c09d 100644 --- a/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/request/system/SystemTalkAnswerConfigRequest.java +++ b/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/request/system/SystemTalkAnswerConfigRequest.java @@ -54,7 +54,9 @@ public class SystemTalkAnswerConfigRequest implements java.io.Serializable { //关键字的排序,越小越第一个匹配上 private Long keyOrder; - //回答类型0:文本问答 1:iOT控制 2:天气 3:闹钟 4:U3D 5:音乐声音 6:询问时间 7:古诗、诗歌、诗 100:固件升级 101:Box上线 200:动作后必须跟的名称词 300秋果专有名词 400:全部,所有,一切忽略词 + /** + * 回答类型0:文本问答 1:iOT控制 2:天气 3:闹钟 4:U3D 5:音乐声音 6:询问时间 7:古诗、诗歌、诗 100:固件升级 101:Box上线 200:动作后必须跟的名称词 300秋果专有名词 301:根据用户编号回答不同 400:全部,所有,一切忽略词 + */ private Integer answerType; /** diff --git a/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/request/system/SystemTalkBindUserRequest.java b/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/request/system/SystemTalkBindUserRequest.java new file mode 100644 index 0000000..af1533b --- /dev/null +++ b/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/request/system/SystemTalkBindUserRequest.java @@ -0,0 +1,95 @@ +package com.qiuguo.iot.data.request.system; +import lombok.Data; +import java.util.Date; +/** +*

+*系统问答和用户绑定关系请求类 +* @author wulin +* @since 2023-10-23 +*/ + + +@Data +public class SystemTalkBindUserRequest implements java.io.Serializable { + + private int currPage = 1; + private int pageSize = 10; + private String sort; + private String order; + /** + * + */ + private Long id; + /** + *是否删除:0 否 1 删除 + */ + private Integer isDelete; + /** + *创建时间 + */ + private Date createTime; + /** + *创建时间搜索开始 + */ + + private Date createTimeStart; + + /** + *创建时间搜索结束 + */ + private Date createTimeEnd; + /** + *修改时间 + */ + private Date modifyTime; + /** + *修改时间搜索开始 + */ + + private Date modifyTimeStart; + + /** + *修改时间搜索结束 + */ + private Date modifyTimeEnd; + /** + *自定义命令id + */ + private Long systemTalkId; + /** + *用户ID + */ + private Long userId; + /** + *动作后的变量,名词 + */ + private String askCommon; + /** + *成功回答内容(传给box) + */ + private String answerValue; + /** + *执行失败回答内容 + */ + private String answerValueFaild; + /** + *回答时的动作(数字人的口型以外动作) + */ + private String answerAction; + /** + *执行失败所对应动作 + */ + private String answerActionFaild; + /** + *回答时的背景音乐(URL) + */ + private String answerBackSound; + /** + *回答时的背景图片、视屏、动画(URL) + */ + private String answerBackImg; + /** + *备注 + */ + private String remark; +} \ No newline at end of file diff --git a/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/resp/system/SystemTalkAnswerConfigResp.java b/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/resp/system/SystemTalkAnswerConfigResp.java index d8d576e..af6211c 100644 --- a/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/resp/system/SystemTalkAnswerConfigResp.java +++ b/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/resp/system/SystemTalkAnswerConfigResp.java @@ -32,7 +32,9 @@ public class SystemTalkAnswerConfigResp { //关键字的排序,越小越第一个匹配上 private Long keyOrder; - //回答类型0:文本问答 1:iOT控制 2:天气 3:闹钟 4:U3D 5:音乐声音 6:询问时间 7:古诗、诗歌、诗 100:固件升级 101:Box上线 200:动作后必须跟的名称词 300秋果专有名词 400:全部,所有,一切忽略词 + /** + * 回答类型0:文本问答 1:iOT控制 2:天气 3:闹钟 4:U3D 5:音乐声音 6:询问时间 7:古诗、诗歌、诗 100:固件升级 101:Box上线 200:动作后必须跟的名称词 300秋果专有名词 301:根据用户编号回答不同 400:全部,所有,一切忽略词 + */ private Integer answerType; /** diff --git a/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/resp/system/SystemTalkBindUserResp.java b/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/resp/system/SystemTalkBindUserResp.java new file mode 100644 index 0000000..af948ca --- /dev/null +++ b/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/resp/system/SystemTalkBindUserResp.java @@ -0,0 +1,84 @@ +package com.qiuguo.iot.data.resp.system; +import com.qiuguo.iot.data.entity.system.SystemTalkBindUserEntity; +import lombok.Data; +import java.util.Date; +/** +*

+*

*系统问答和用户绑定关系返回类 +* @author wulin +* @since 2023-10-23 +*/ + +@Data +public class SystemTalkBindUserResp { + public SystemTalkBindUserResp(){ + } + public SystemTalkBindUserResp(SystemTalkBindUserEntity entity){ + id = entity.getId(); + createTime = entity.getCreateTime(); + modifyTime = entity.getModifyTime(); + systemTalkId = entity.getSystemTalkId(); + userId = entity.getUserId(); + askCommon = entity.getAskCommon(); + answerValue = entity.getAnswerValue(); + answerValueFaild = entity.getAnswerValueFaild(); + answerAction = entity.getAnswerAction(); + answerActionFaild = entity.getAnswerActionFaild(); + answerBackSound = entity.getAnswerBackSound(); + answerBackImg = entity.getAnswerBackImg(); + remark = entity.getRemark(); + } + + /** + * + */ + private Long id; + /** + *创建时间 + */ + private Date createTime; + /** + *修改时间 + */ + private Date modifyTime; + /** + *自定义命令id + */ + private Long systemTalkId; + /** + *用户ID + */ + private Long userId; + /** + *动作后的变量,名词 + */ + private String askCommon; + /** + *成功回答内容(传给box) + */ + private String answerValue; + /** + *执行失败回答内容 + */ + private String answerValueFaild; + /** + *回答时的动作(数字人的口型以外动作) + */ + private String answerAction; + /** + *执行失败所对应动作 + */ + private String answerActionFaild; + /** + *回答时的背景音乐(URL) + */ + private String answerBackSound; + /** + *回答时的背景图片、视屏、动画(URL) + */ + private String answerBackImg; + /** + *备注 + */ + private String remark; +} \ No newline at end of file diff --git a/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/service/system/SystemTalkBindUserService.java b/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/service/system/SystemTalkBindUserService.java new file mode 100644 index 0000000..695ea72 --- /dev/null +++ b/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/service/system/SystemTalkBindUserService.java @@ -0,0 +1,253 @@ +package com.qiuguo.iot.data.service.system; + + + +import com.qiuguo.iot.base.utils.StringUtils; +import com.qiuguo.iot.data.entity.system.SystemTalkBindUserEntity; +import com.qiuguo.iot.data.request.system.SystemTalkBindUserRequest; + +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.dml.query.SortOrder; +import org.hswebframework.web.api.crud.entity.PagerResult; +import org.hswebframework.web.api.crud.entity.QueryParamEntity; +import org.hswebframework.web.crud.service.GenericReactiveCrudService; +import org.springframework.stereotype.Service; +import reactor.core.publisher.Mono; +import lombok.extern.slf4j.Slf4j; + +import java.util.Arrays; +import java.util.Date; +/** +*

+* 系统问答和用户绑定关系服务类 +*

+* +* @author wulin +* @since 2023-10-23 +*/ + +@Service +@Slf4j +public class SystemTalkBindUserService extends GenericReactiveCrudService { + + + public Mono selectSystemTalkBindUserByRequest(SystemTalkBindUserRequest request){ + ReactiveQuery reactiveQuery = createQuery(); + reactiveQuery = reactiveQuery.and("is_delete", 0); + if(request.getId() != null){ + reactiveQuery = reactiveQuery.and(SystemTalkBindUserRequest::getId, request.getId()); + } + if(request.getIsDelete() != null){ + reactiveQuery = reactiveQuery.and(SystemTalkBindUserRequest::getIsDelete, request.getIsDelete()); + } + if(request.getCreateTime() != null){ + reactiveQuery = reactiveQuery.and(SystemTalkBindUserRequest::getCreateTime, request.getCreateTime()); + } + if(request.getModifyTime() != null){ + reactiveQuery = reactiveQuery.and(SystemTalkBindUserRequest::getModifyTime, request.getModifyTime()); + } + if(request.getSystemTalkId() != null){ + reactiveQuery = reactiveQuery.and(SystemTalkBindUserRequest::getSystemTalkId, request.getSystemTalkId()); + } + if(request.getUserId() != null){ + reactiveQuery = reactiveQuery.and(SystemTalkBindUserRequest::getUserId, request.getUserId()); + } + if(StringUtils.isNotEmpty(request.getAskCommon())){ + reactiveQuery = reactiveQuery.and(SystemTalkBindUserRequest::getAskCommon, request.getAskCommon()); + } + if(StringUtils.isNotEmpty(request.getAnswerValue())){ + reactiveQuery = reactiveQuery.and(SystemTalkBindUserRequest::getAnswerValue, request.getAnswerValue()); + } + if(StringUtils.isNotEmpty(request.getAnswerValueFaild())){ + reactiveQuery = reactiveQuery.and(SystemTalkBindUserRequest::getAnswerValueFaild, request.getAnswerValueFaild()); + } + if(StringUtils.isNotEmpty(request.getAnswerAction())){ + reactiveQuery = reactiveQuery.and(SystemTalkBindUserRequest::getAnswerAction, request.getAnswerAction()); + } + if(StringUtils.isNotEmpty(request.getAnswerActionFaild())){ + reactiveQuery = reactiveQuery.and(SystemTalkBindUserRequest::getAnswerActionFaild, request.getAnswerActionFaild()); + } + if(StringUtils.isNotEmpty(request.getAnswerBackSound())){ + reactiveQuery = reactiveQuery.and(SystemTalkBindUserRequest::getAnswerBackSound, request.getAnswerBackSound()); + } + if(StringUtils.isNotEmpty(request.getAnswerBackImg())){ + reactiveQuery = reactiveQuery.and(SystemTalkBindUserRequest::getAnswerBackImg, request.getAnswerBackImg()); + } + if(StringUtils.isNotEmpty(request.getRemark())){ + reactiveQuery = reactiveQuery.and(SystemTalkBindUserRequest::getRemark, request.getRemark()); + } + SortOrder sortOrder = null; + if(StringUtils.isNotEmpty(request.getOrder())){ + if(StringUtils.isNotEmpty(request.getSort()) && request.getSort().compareTo("0") == 0){ + sortOrder = SortOrder.desc(request.getOrder()); + }else{ + sortOrder = SortOrder.asc(request.getOrder()); + } + reactiveQuery = reactiveQuery.orderBy(sortOrder); + } + return reactiveQuery.fetchOne(); + } + + + + public Mono> selectSystemTalkBindUsersByRequest(SystemTalkBindUserRequest request){ + ReactiveQuery reactiveQuery = createQuery(); + reactiveQuery = reactiveQuery.and("is_delete", 0); + if(request.getId() != null){ + reactiveQuery = reactiveQuery.and(SystemTalkBindUserRequest::getId, request.getId()); + } + if(request.getIsDelete() != null){ + reactiveQuery = reactiveQuery.and(SystemTalkBindUserRequest::getIsDelete, request.getIsDelete()); + } + if(request.getCreateTimeStart() != null){ + reactiveQuery = reactiveQuery.gte(SystemTalkBindUserRequest::getCreateTime, request.getCreateTimeStart()); + } + if(request.getCreateTimeEnd() != null){ + reactiveQuery = reactiveQuery.lte(SystemTalkBindUserRequest::getCreateTime, request.getCreateTimeEnd()); + } + if(request.getModifyTimeStart() != null){ + reactiveQuery = reactiveQuery.gte(SystemTalkBindUserRequest::getModifyTime, request.getModifyTimeStart()); + } + if(request.getModifyTimeEnd() != null){ + reactiveQuery = reactiveQuery.lte(SystemTalkBindUserRequest::getModifyTime, request.getModifyTimeEnd()); + } + if(request.getSystemTalkId() != null){ + reactiveQuery = reactiveQuery.and(SystemTalkBindUserRequest::getSystemTalkId, request.getSystemTalkId()); + } + if(request.getUserId() != null){ + reactiveQuery = reactiveQuery.and(SystemTalkBindUserRequest::getUserId, request.getUserId()); + } + if(StringUtils.isNotEmpty(request.getAskCommon())){ + reactiveQuery = reactiveQuery.$like$(SystemTalkBindUserRequest::getAskCommon, request.getAskCommon()); + } + if(StringUtils.isNotEmpty(request.getAnswerValue())){ + reactiveQuery = reactiveQuery.$like$(SystemTalkBindUserRequest::getAnswerValue, request.getAnswerValue()); + } + if(StringUtils.isNotEmpty(request.getAnswerValueFaild())){ + reactiveQuery = reactiveQuery.$like$(SystemTalkBindUserRequest::getAnswerValueFaild, request.getAnswerValueFaild()); + } + if(StringUtils.isNotEmpty(request.getAnswerAction())){ + reactiveQuery = reactiveQuery.$like$(SystemTalkBindUserRequest::getAnswerAction, request.getAnswerAction()); + } + if(StringUtils.isNotEmpty(request.getAnswerActionFaild())){ + reactiveQuery = reactiveQuery.$like$(SystemTalkBindUserRequest::getAnswerActionFaild, request.getAnswerActionFaild()); + } + if(StringUtils.isNotEmpty(request.getAnswerBackSound())){ + reactiveQuery = reactiveQuery.$like$(SystemTalkBindUserRequest::getAnswerBackSound, request.getAnswerBackSound()); + } + if(StringUtils.isNotEmpty(request.getAnswerBackImg())){ + reactiveQuery = reactiveQuery.$like$(SystemTalkBindUserRequest::getAnswerBackImg, request.getAnswerBackImg()); + } + if(StringUtils.isNotEmpty(request.getRemark())){ + reactiveQuery = reactiveQuery.$like$(SystemTalkBindUserRequest::getRemark, request.getRemark()); + } + QueryParamEntity param = QueryParamEntity.of(reactiveQuery.getParam()); + if(StringUtils.isNotEmpty(request.getOrder())){ + Sort sort = new Sort(); + sort.setName(request.getOrder()); + if(StringUtils.isNotEmpty(request.getSort()) && request.getSort().compareTo("0") == 0){ + sort.desc(); + }else{ + sort.asc(); + } + param.setSorts(Arrays.asList(sort)); + } + param.setPageIndex(request.getCurrPage()); + param.setPageSize(request.getPageSize()); + param.setPaging(true); + param.setFirstPageIndex(1); + return queryPager(param); + } + + + + public Mono selectSystemTalkBindUserById(Long id){ + return createQuery() + .and("is_delete", 0) + .and("id", id) + .fetchOne(); + } + + + + public Mono insertSystemTalkBindUser(SystemTalkBindUserEntity entity){ + entity.setId(null); + entity.setCreateTime(null); + entity.setModifyTime(null); + return insert(entity); + } + + + + public Mono updateSystemTalkBindUserById(SystemTalkBindUserEntity entity){ + ReactiveUpdate update = createUpdate() + .set(SystemTalkBindUserEntity::getModifyTime, new Date()); + if(entity.getIsDelete() != null){ + update = update.set(SystemTalkBindUserEntity::getIsDelete, entity.getIsDelete()); + } + if(entity.getSystemTalkId() != null){ + update = update.set(SystemTalkBindUserEntity::getSystemTalkId, entity.getSystemTalkId()); + } + if(entity.getUserId() != null){ + update = update.set(SystemTalkBindUserEntity::getUserId, entity.getUserId()); + } + if(StringUtils.isNotEmpty(entity.getAskCommon())){ + update = update.set(SystemTalkBindUserEntity::getAskCommon, entity.getAskCommon()); + } + if(StringUtils.isNotEmpty(entity.getAnswerValue())){ + update = update.set(SystemTalkBindUserEntity::getAnswerValue, entity.getAnswerValue()); + } + if(StringUtils.isNotEmpty(entity.getAnswerValueFaild())){ + update = update.set(SystemTalkBindUserEntity::getAnswerValueFaild, entity.getAnswerValueFaild()); + } + if(StringUtils.isNotEmpty(entity.getAnswerAction())){ + update = update.set(SystemTalkBindUserEntity::getAnswerAction, entity.getAnswerAction()); + } + if(StringUtils.isNotEmpty(entity.getAnswerActionFaild())){ + update = update.set(SystemTalkBindUserEntity::getAnswerActionFaild, entity.getAnswerActionFaild()); + } + if(StringUtils.isNotEmpty(entity.getAnswerBackSound())){ + update = update.set(SystemTalkBindUserEntity::getAnswerBackSound, entity.getAnswerBackSound()); + } + if(StringUtils.isNotEmpty(entity.getAnswerBackImg())){ + update = update.set(SystemTalkBindUserEntity::getAnswerBackImg, entity.getAnswerBackImg()); + } + if(StringUtils.isNotEmpty(entity.getRemark())){ + update = update.set(SystemTalkBindUserEntity::getRemark, entity.getRemark()); + } + return update.where(SystemTalkBindUserEntity::getId, entity.getId()).and("is_delete", 0).execute(); + } + + + + public Mono updateCoverSystemTalkBindUserById(SystemTalkBindUserEntity entity){ + ReactiveUpdate update = createUpdate() + .set(SystemTalkBindUserEntity::getModifyTime, new Date()); + update = update.set(SystemTalkBindUserEntity::getIsDelete, entity.getIsDelete()); + update = update.set(SystemTalkBindUserEntity::getSystemTalkId, entity.getSystemTalkId()); + update = update.set(SystemTalkBindUserEntity::getUserId, entity.getUserId()); + update = update.set(SystemTalkBindUserEntity::getAskCommon, entity.getAskCommon()); + update = update.set(SystemTalkBindUserEntity::getAnswerValue, entity.getAnswerValue()); + update = update.set(SystemTalkBindUserEntity::getAnswerValueFaild, entity.getAnswerValueFaild()); + update = update.set(SystemTalkBindUserEntity::getAnswerAction, entity.getAnswerAction()); + update = update.set(SystemTalkBindUserEntity::getAnswerActionFaild, entity.getAnswerActionFaild()); + update = update.set(SystemTalkBindUserEntity::getAnswerBackSound, entity.getAnswerBackSound()); + update = update.set(SystemTalkBindUserEntity::getAnswerBackImg, entity.getAnswerBackImg()); + update = update.set(SystemTalkBindUserEntity::getRemark, entity.getRemark()); + return update.where(SystemTalkBindUserEntity::getId, entity.getId()).and("is_delete", 0).execute(); + } + + + + public Mono deleteSystemTalkBindUserById(Long id){ + return createUpdate() + .set("is_delete", 1) + .set("modify_time", new Date()) + .where("id", id) + .execute(); + } + + +} diff --git a/iot-common/iot-third/src/main/java/com/qiuguo/iot/third/enums/ChinesePartSpeechEnum.java b/iot-common/iot-third/src/main/java/com/qiuguo/iot/third/enums/ChinesePartSpeechEnum.java index f76b0fa..32a3fcb 100644 --- a/iot-common/iot-third/src/main/java/com/qiuguo/iot/third/enums/ChinesePartSpeechEnum.java +++ b/iot-common/iot-third/src/main/java/com/qiuguo/iot/third/enums/ChinesePartSpeechEnum.java @@ -720,7 +720,7 @@ public enum ChinesePartSpeechEnum implements IChinesePartSpeech{ //动词后面的名词只支持已经产生的action,后面的不要 int index = Integer.parseInt(key.replace("#", "")); SystemTalkAnswerConfigEntity command = commands.get(index); - if(command.getAnswerType().equals(AskTypeEnum.QIU_GUO.getCode())){ + if(command.getAnswerType() >= AskTypeEnum.QIU_GUO.getCode() && command.getAnswerType() < AskTypeEnum.IGNORE.getCode()){ //秋果专有名称 systemTalkAnswerConfigEntities.add(command); action.setSystemTalkAnswerConfigEntity(command); diff --git a/iot-common/iot-third/src/main/java/com/qiuguo/iot/third/service/LacNlpService.java b/iot-common/iot-third/src/main/java/com/qiuguo/iot/third/service/LacNlpService.java index 53d05b5..0e238ef 100644 --- a/iot-common/iot-third/src/main/java/com/qiuguo/iot/third/service/LacNlpService.java +++ b/iot-common/iot-third/src/main/java/com/qiuguo/iot/third/service/LacNlpService.java @@ -62,7 +62,7 @@ public class LacNlpService implements INlp { @Override public Mono geSingletNlp(String value) { - if(SpringUtil.getProperty("lac.type").equals("suanfa")){ + if(!SpringUtil.getProperty("lac.type").equals("suanfa")){ return getHubFaLac(value); } return getSuanFaLac(value); diff --git a/iot-modules/iot-admin-http-api/src/main/resources/logback-pro.xml b/iot-modules/iot-admin-http-api/src/main/resources/logback-prod.xml similarity index 100% rename from iot-modules/iot-admin-http-api/src/main/resources/logback-pro.xml rename to iot-modules/iot-admin-http-api/src/main/resources/logback-prod.xml diff --git a/iot-modules/iot-box-user-api/src/main/resources/bootstrap-prod.yml b/iot-modules/iot-box-user-api/src/main/resources/bootstrap-prod.yml index 6d97184..d68207d 100644 --- a/iot-modules/iot-box-user-api/src/main/resources/bootstrap-prod.yml +++ b/iot-modules/iot-box-user-api/src/main/resources/bootstrap-prod.yml @@ -3,10 +3,17 @@ spring: nacos: discovery: # 服务注册地址 +<<<<<<< HEAD + server-addr: 8.139.5.211:30731 + config: + # 配置中心地址 + server-addr: 8.139.5.211:30731 +======= server-addr: qiuguo-nacos.qiuguo-cloud:8848 config: # 配置中心地址 server-addr: qiuguo-nacos.qiuguo-cloud:8848 +>>>>>>> 64da585a2f5a786febdbeaafd130d2fd086ee8e1 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/iot-modules/iot-box-user-api/src/main/resources/logback-pro.xml b/iot-modules/iot-box-user-api/src/main/resources/logback-prod.xml similarity index 100% rename from iot-modules/iot-box-user-api/src/main/resources/logback-pro.xml rename to iot-modules/iot-box-user-api/src/main/resources/logback-prod.xml diff --git a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/domain/box/BoxSession.java b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/domain/box/BoxSession.java index 29f91e6..df87da7 100644 --- a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/domain/box/BoxSession.java +++ b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/domain/box/BoxSession.java @@ -10,5 +10,8 @@ import reactor.core.publisher.FluxSink; @Data public class BoxSession extends BaseSession { - + /** + * TTS合成声音的声音标识 + */ + String tts; } diff --git a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/BaseWebSocketProcess.java b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/BaseWebSocketProcess.java index 25668b4..f121b45 100644 --- a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/BaseWebSocketProcess.java +++ b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/BaseWebSocketProcess.java @@ -16,10 +16,12 @@ import com.qiuguo.iot.data.entity.device.DeviceUserBindEntity; import com.qiuguo.iot.data.entity.device.DeviceUserTalkRecordEntity; import com.qiuguo.iot.data.entity.system.SystemTalkBindDeviceEntity; import com.qiuguo.iot.data.entity.system.SystemTalkBindU3dEntity; +import com.qiuguo.iot.data.entity.system.SystemTalkBindUserEntity; import com.qiuguo.iot.data.request.device.DeviceUserBindRequest; import com.qiuguo.iot.data.request.qwen.TongYiCommunicationRest; import com.qiuguo.iot.data.request.system.SystemTalkBindDeviceRequest; import com.qiuguo.iot.data.request.system.SystemTalkBindU3dRequest; +import com.qiuguo.iot.data.request.system.SystemTalkBindUserRequest; import com.qiuguo.iot.data.request.third.ThirdWeatherInfoRequest; import com.qiuguo.iot.data.resp.third.MusicResp; import com.qiuguo.iot.data.resp.third.weather.TianqiapiItemResp; @@ -30,6 +32,7 @@ import com.qiuguo.iot.data.service.mq.MqService; import com.qiuguo.iot.data.service.system.SystemAddressService; import com.qiuguo.iot.data.service.system.SystemTalkBindDeviceService; import com.qiuguo.iot.data.service.system.SystemTalkBindU3dService; +import com.qiuguo.iot.data.service.system.SystemTalkBindUserService; import com.qiuguo.iot.third.nlp.action.Action; import com.qiuguo.iot.third.nlp.action.ActionTime; import com.qiuguo.iot.third.nlp.action.Actions; @@ -91,6 +94,9 @@ public class BaseWebSocketProcess { @Autowired AudioService audioService; + @Autowired + SystemTalkBindUserService systemTalkBindUserService; + @Value("${tts.suanfa}") boolean ttsSuanfa; @@ -430,6 +436,22 @@ public class BaseWebSocketProcess { }else if(action.getSystemTalkAnswerConfigEntity().getAnswerType().equals(AskTypeEnum.QIU_GUO.getCode())){ return sendMessage(action, baseSession, action.getSystemTalkAnswerConfigEntity().getAnswerValue(), AskTypeEnum.TTS.getCode()); + }else if(action.getSystemTalkAnswerConfigEntity().getAnswerType().equals(AskTypeEnum.USER_CONFIG.getCode())){ + SystemTalkBindUserRequest request = new SystemTalkBindUserRequest(); + request.setUserId(baseSession.getUserId()); + request.setSystemTalkId(action.getSystemTalkAnswerConfigEntity().getId()); + request.setAskCommon(action.getActionCommand()); + return systemTalkBindUserService.selectSystemTalkBindUserByRequest(request).defaultIfEmpty(new SystemTalkBindUserEntity()) + .flatMap(entity -> { + if(entity.getUserId() == null){ + log.info("调用默认的回答"); + return sendMessage(action, baseSession, action.getSystemTalkAnswerConfigEntity().getAnswerValue(), AskTypeEnum.TTS.getCode()); + }else{ + log.info("调用用户匹配的回答"); + return sendMessage(action, baseSession, entity.getAnswerValue(), AskTypeEnum.TTS.getCode()); + } + }); + }else if(action.getSystemTalkAnswerConfigEntity().getAnswerType().equals(AskTypeEnum.TIME.getCode())){ DateTimeFormatter df = DateTimeFormatter.ofPattern(action.getSystemTalkAnswerConfigEntity().getAnswerValue()); if(action.getTime() == null){ @@ -730,10 +752,10 @@ public class BaseWebSocketProcess { BeanUtils.copyProperties(baseMessageResp, boxMessageResp); sendAudioMessage(baseSession, boxMessageResp).subscribe(); } + return; } - }else{ - sendMsg(baseSession, JSONObject.toJSONString(baseMessageResp)); } + sendMsg(baseSession, JSONObject.toJSONString(baseMessageResp)); } /** diff --git a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/BoxWebSocketHandler.java b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/BoxWebSocketHandler.java index 37f913d..355b020 100644 --- a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/BoxWebSocketHandler.java +++ b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/BoxWebSocketHandler.java @@ -234,7 +234,7 @@ public class BoxWebSocketHandler extends BaseWebSocketProcess implements WebSock } - private Mono bindBox(BaseSession baseSession, DeviceInfoEntity dv, Long userId, Integer isBind){ + private Mono bindBox(BoxSession boxSession, DeviceInfoEntity dv, Long userId, Integer isBind){ log.info("开始绑定设备userId:{}, SN:{}", userId, dv); DeviceUserBindRequest request = new DeviceUserBindRequest(); @@ -261,6 +261,7 @@ public class BoxWebSocketHandler extends BaseWebSocketProcess implements WebSock }); }else{ + boxSession.setTts(entity.getTts()); if(entity.getIsBind().equals(YesNo.YES.getCode())){ //通知用户端设备绑定成功 sendNoticeToUser(userId, "设备联网成功,设备序列号:" + dv.getSn(), AskTypeEnum.BOX_ON_LINE.getCode()); @@ -279,7 +280,7 @@ public class BoxWebSocketHandler extends BaseWebSocketProcess implements WebSock }); }else{ - return closeSendMsg(baseSession, "设备已解绑无法继续使用", AskTypeEnum.DEVICE_UNBIND.getCode()).flatMap( + return closeSendMsg(boxSession, "设备已解绑无法继续使用", AskTypeEnum.DEVICE_UNBIND.getCode()).flatMap( v -> { return Mono.just(entity); } diff --git a/iot-modules/iot-box-websocket-api/src/main/resources/bootstrap-dev.yml b/iot-modules/iot-box-websocket-api/src/main/resources/bootstrap-dev.yml index a420758..059c92a 100644 --- a/iot-modules/iot-box-websocket-api/src/main/resources/bootstrap-dev.yml +++ b/iot-modules/iot-box-websocket-api/src/main/resources/bootstrap-dev.yml @@ -43,7 +43,7 @@ qiuguo: checktoken: url: https://qiuguo-app.pre.qiuguojihua.com/pre-api/user/user/getUser tts: - suanfa: true + suanfa: false lac: type: suanfa hub: diff --git a/iot-modules/iot-box-websocket-api/src/main/resources/logback-pro.xml b/iot-modules/iot-box-websocket-api/src/main/resources/logback-prod.xml similarity index 100% rename from iot-modules/iot-box-websocket-api/src/main/resources/logback-pro.xml rename to iot-modules/iot-box-websocket-api/src/main/resources/logback-prod.xml diff --git a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlMain.java b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlMain.java index 2da1c41..9098b47 100644 --- a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlMain.java +++ b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlMain.java @@ -59,7 +59,7 @@ public class MysqlMain { } List list = new ArrayList<>(); - list.add(new TablesBean("system_talk_bind_u3d")); + list.add(new TablesBean("system_talk_bind_user")); //list.add(new TablesBean("system_same_talk")); List list2 = new ArrayList();