feat:机器人CRUD接口实现
This commit is contained in:
parent
9fcbd3bda5
commit
452de6043c
@ -24,8 +24,8 @@ import java.util.List;
|
|||||||
public interface AccountApi {
|
public interface AccountApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 普通用户生成网易云信IM账户
|
* 普通用户生成IM账户
|
||||||
* 因多终端场景,同一个普通用户会申请多个云信账户,用于不同的app终端
|
* 因多终端场景,同一个普通用户会申请多个网易云信账户,用于不同的app终端
|
||||||
* 例如工人端一个IM账户,企业端一个IM账户,根据不同的appType来区分
|
* 例如工人端一个IM账户,企业端一个IM账户,根据不同的appType来区分
|
||||||
*
|
*
|
||||||
* @param userAccountReq 生成云信账户参数
|
* @param userAccountReq 生成云信账户参数
|
||||||
@ -38,18 +38,18 @@ public interface AccountApi {
|
|||||||
* 查询注册账户信息
|
* 查询注册账户信息
|
||||||
*
|
*
|
||||||
* @param accountQuery 账户查询条件
|
* @param accountQuery 账户查询条件
|
||||||
* @return 返回云信IM账户
|
* @return 返回IM账户
|
||||||
*/
|
*/
|
||||||
@PostMapping("api/im/account/register/query")
|
@PostMapping("api/im/account/register/query")
|
||||||
ApiResult<List<UserAccountResp>> queryRegisterAccountInfo(@RequestBody @Validated AccountQuery accountQuery);
|
ApiResult<List<UserAccountResp>> queryRegisterAccountInfo(@RequestBody @Validated AccountQuery accountQuery);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机器人生成网易云信IM账户
|
* 机器人生成IM账户
|
||||||
* 机器人通过PC端创建IM账户,不需要appType来区分
|
* 机器人通过PC端创建IM账户,不需要appType来区分
|
||||||
*
|
*
|
||||||
* @param robotAccountReq 生成云信账户参数
|
* @param robotAccountReq 生成IM账户参数
|
||||||
* @return 返回云信IM账户
|
* @return 返回IM账户
|
||||||
*/
|
*/
|
||||||
@PostMapping("api/im/account/robot/generate")
|
@PostMapping("api/im/account/robot/generate")
|
||||||
ApiResult<UserAccountResp> generateRobotAccount(@RequestBody @Validated RobotAccountReq robotAccountReq);
|
ApiResult<UserAccountResp> generateRobotAccount(@RequestBody @Validated RobotAccountReq robotAccountReq);
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import java.util.List;
|
|||||||
* @date 2023/10/9 16:01
|
* @date 2023/10/9 16:01
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@FeignClient(name = "im-center", url = "${axzo.service.im-center:http://im:8080}")
|
@FeignClient(name = "im-center", url = "${axzo.service.im-center:http://im-center:8080}")
|
||||||
public interface RobotInfoApi {
|
public interface RobotInfoApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,7 +60,7 @@ public interface RobotInfoApi {
|
|||||||
* @param robotPageQuery 机器人查询条件
|
* @param robotPageQuery 机器人查询条件
|
||||||
* @return 机器人列表信息
|
* @return 机器人列表信息
|
||||||
*/
|
*/
|
||||||
@GetMapping("api/im/robot/page")
|
@PostMapping("api/im/robot/page")
|
||||||
ApiPageResult<RobotInfoResp> queryRobotList(@RequestBody RobotPageQuery robotPageQuery);
|
ApiPageResult<RobotInfoResp> queryRobotList(@RequestBody RobotPageQuery robotPageQuery);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机器人标签API
|
* 机器人标签API
|
||||||
*
|
*
|
||||||
@ -59,7 +61,15 @@ public interface RobotTagApi {
|
|||||||
* @param robotTagQuery 机器人标签查询条件
|
* @param robotTagQuery 机器人标签查询条件
|
||||||
* @return 返回机器人标签列表
|
* @return 返回机器人标签列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("api/im/robot/tag/page")
|
@PostMapping("api/im/robot/tag/page")
|
||||||
ApiPageResult<RobotTagResp> queryRobotTagList(@RequestBody RobotTagQuery robotTagQuery);
|
ApiPageResult<RobotTagResp> queryRobotTagList(@RequestBody RobotTagQuery robotTagQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询当前所有可用的机器人标签列表
|
||||||
|
*
|
||||||
|
* @return 返回机器人标签列表
|
||||||
|
*/
|
||||||
|
@GetMapping("api/im/robot/tag/valid")
|
||||||
|
ApiResult<List<RobotTagResp>> queryRobotTagValidList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,8 +25,8 @@ public class RobotInfoReq {
|
|||||||
/**
|
/**
|
||||||
* 机器人Tag列表
|
* 机器人Tag列表
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "机器人标签不能为空")
|
@NotNull(message = "机器人标签ID不能为空")
|
||||||
private List<String> tagNameList;
|
private List<Long> tagNameList;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -18,9 +18,14 @@ public class RobotPageQuery extends PageRequest {
|
|||||||
*/
|
*/
|
||||||
private String nickName;
|
private String nickName;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机器人状态
|
* 机器人状态
|
||||||
|
* ("creating", "待生成IM账号"),
|
||||||
|
* ("un_enable", "待启用"),
|
||||||
|
* ("enabled", "运行中"),
|
||||||
|
* ("disabled", "已停用");
|
||||||
|
*
|
||||||
|
* @see cn.axzo.im.center.common.enums.RobotStatusEnum
|
||||||
*/
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
|||||||
@ -27,8 +27,8 @@ public class RobotTagReq {
|
|||||||
* 机器人Tag名称
|
* 机器人Tag名称
|
||||||
* 对外展示 不允许重复
|
* 对外展示 不允许重复
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "机器人Tag名称不能为空")
|
@NotNull(message = "机器人标签名称不能为空")
|
||||||
@Length(max = 20, message = "机器人Tag名称最长为20个字符")
|
@Length(max = 20, message = "机器人标签名称最长为20个字符")
|
||||||
private String tagName;
|
private String tagName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,6 +48,6 @@ public class RobotTagReq {
|
|||||||
/**
|
/**
|
||||||
* 机器人Tag颜色
|
* 机器人Tag颜色
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "机器人Tag颜色不能为空")
|
@NotNull(message = "机器人标签颜色不能为空")
|
||||||
private String color;
|
private String color;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,11 +15,13 @@ import java.util.List;
|
|||||||
@Data
|
@Data
|
||||||
public class UpdateRobotInfoReq {
|
public class UpdateRobotInfoReq {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机器人ID
|
* 机器人ID
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "机器人ID不能为空")
|
@NotNull(message = "机器人ID不能为空")
|
||||||
private Integer robotId;
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机器人昵称
|
* 机器人昵称
|
||||||
@ -31,7 +33,7 @@ public class UpdateRobotInfoReq {
|
|||||||
* 机器人Tag列表
|
* 机器人Tag列表
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "机器人标签不能为空")
|
@NotNull(message = "机器人标签不能为空")
|
||||||
private List<String> tagNameList;
|
private List<Long> tagNameList;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -26,7 +26,7 @@ public class UpdateRobotTagReq {
|
|||||||
/**
|
/**
|
||||||
* 机器人tagId
|
* 机器人tagId
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "机器人tagId不能为空")
|
@NotNull(message = "机器人标签不能为空")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -7,8 +7,8 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* 机器人页面显示信息
|
* 机器人页面显示信息
|
||||||
*
|
*
|
||||||
* @version V1.0
|
|
||||||
* @author zuoqinbo
|
* @author zuoqinbo
|
||||||
|
* @version V1.0
|
||||||
* @date 2023/10/9 16:01
|
* @date 2023/10/9 16:01
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@ -16,7 +16,7 @@ public class RobotInfoResp {
|
|||||||
/**
|
/**
|
||||||
* 机器人ID
|
* 机器人ID
|
||||||
*/
|
*/
|
||||||
private Integer robotId;
|
private String robotId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机器人昵称
|
* 机器人昵称
|
||||||
@ -46,14 +46,14 @@ public class RobotInfoResp {
|
|||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息模板失效数量
|
* 机器人已上架消息模板数量
|
||||||
*/
|
*/
|
||||||
private Integer msgTemplateInvalidCount = 5;
|
private Integer msgTemplateValid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息模板数量
|
* 机器人关联消息模板总数量
|
||||||
*/
|
*/
|
||||||
private Integer msgTemplateCount = 10;
|
private Integer msgTemplateTotal;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,7 @@ public class RobotTagResp {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机器人使用数量
|
* 被机器人使用数量
|
||||||
*/
|
*/
|
||||||
private Integer useCount;
|
private Integer useCount;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,18 +19,18 @@ public class UserAccountResp {
|
|||||||
private String userId;
|
private String userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机器人IM云信账户
|
* 机器人IM账户
|
||||||
*/
|
*/
|
||||||
private String imAccount;
|
private String imAccount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Token
|
* 静态Token
|
||||||
*/
|
*/
|
||||||
private String token;
|
private String token;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册不成功,返回网易云信描述信息
|
* 注册不成功时,返回系统描述信息
|
||||||
*/
|
*/
|
||||||
private String desc;
|
private String desc;
|
||||||
|
|
||||||
|
|||||||
@ -16,4 +16,5 @@ D:\im-center\im-center-api\src\main\java\cn\axzo\im\center\api\vo\req\RobotTagQu
|
|||||||
D:\im-center\im-center-api\src\main\java\cn\axzo\im\center\api\vo\resp\MessageResp.java
|
D:\im-center\im-center-api\src\main\java\cn\axzo\im\center\api\vo\resp\MessageResp.java
|
||||||
D:\im-center\im-center-api\src\main\java\cn\axzo\im\center\api\vo\resp\RobotInfoResp.java
|
D:\im-center\im-center-api\src\main\java\cn\axzo\im\center\api\vo\resp\RobotInfoResp.java
|
||||||
D:\im-center\im-center-api\src\main\java\cn\axzo\im\center\api\vo\req\UpdateRobotInfoReq.java
|
D:\im-center\im-center-api\src\main\java\cn\axzo\im\center\api\vo\req\UpdateRobotInfoReq.java
|
||||||
|
D:\im-center\im-center-api\src\main\java\cn\axzo\im\center\api\vo\req\AccountQuery.java
|
||||||
D:\im-center\im-center-api\src\main\java\cn\axzo\im\center\api\vo\resp\RobotMsgTemplateResp.java
|
D:\im-center\im-center-api\src\main\java\cn\axzo\im\center\api\vo\resp\RobotMsgTemplateResp.java
|
||||||
|
|||||||
@ -1,13 +1,14 @@
|
|||||||
package cn.axzo.im.center.common.enums;
|
package cn.axzo.im.center.common.enums;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机器人状态
|
* 机器人状态
|
||||||
*
|
*
|
||||||
* @version V1.0
|
|
||||||
* @author zuoqinbo
|
* @author zuoqinbo
|
||||||
|
* @version V1.0
|
||||||
* @date 2023/10/9 16:01
|
* @date 2023/10/9 16:01
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@ -26,4 +27,17 @@ public enum RobotStatusEnum {
|
|||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static RobotStatusEnum isValidRobotStatus(String robotStatus) {
|
||||||
|
if (StringUtils.isBlank(robotStatus)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
RobotStatusEnum[] robotStatusEnums = RobotStatusEnum.values();
|
||||||
|
for (RobotStatusEnum robotStatusEnum : robotStatusEnums) {
|
||||||
|
if (robotStatusEnum.getCode().equals(robotStatus.toLowerCase())) {
|
||||||
|
return robotStatusEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,4 +50,10 @@ public class RobotTagController implements RobotTagApi {
|
|||||||
PageResp<RobotTagResp> robotTagRespPage = robotTagService.queryRobotTagList(robotTagQuery);
|
PageResp<RobotTagResp> robotTagRespPage = robotTagService.queryRobotTagList(robotTagQuery);
|
||||||
return ApiPageResult.ok(robotTagRespPage);
|
return ApiPageResult.ok(robotTagRespPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApiResult<List<RobotTagResp>> queryRobotTagValidList() {
|
||||||
|
List<RobotTagResp> robotTagsResp = robotTagService.queryRobotTagValidList();
|
||||||
|
return ApiResult.ok(robotTagsResp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,18 +1,9 @@
|
|||||||
package cn.axzo.im.dao.repository;
|
package cn.axzo.im.dao.repository;
|
||||||
|
|
||||||
import cn.axzo.im.center.api.vo.req.RobotPageQuery;
|
|
||||||
import cn.axzo.im.dao.mapper.AccountRegisterMapper;
|
import cn.axzo.im.dao.mapper.AccountRegisterMapper;
|
||||||
import cn.axzo.im.dao.mapper.RobotInfoMapper;
|
|
||||||
import cn.axzo.im.entity.AccountRegister;
|
import cn.axzo.im.entity.AccountRegister;
|
||||||
import cn.axzo.im.entity.RobotInfo;
|
|
||||||
import cn.axzo.im.enums.RobotStatus;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账户服务Dao
|
* 账户服务Dao
|
||||||
|
|||||||
@ -1,14 +1,13 @@
|
|||||||
package cn.axzo.im.dao.repository;
|
package cn.axzo.im.dao.repository;
|
||||||
|
|
||||||
import cn.axzo.im.center.api.vo.req.RobotPageQuery;
|
import cn.axzo.im.center.api.vo.req.RobotPageQuery;
|
||||||
|
import cn.axzo.im.center.common.enums.RobotStatusEnum;
|
||||||
import cn.axzo.im.dao.mapper.RobotInfoMapper;
|
import cn.axzo.im.dao.mapper.RobotInfoMapper;
|
||||||
import cn.axzo.im.entity.RobotInfo;
|
import cn.axzo.im.entity.RobotInfo;
|
||||||
import cn.axzo.im.enums.RobotStatus;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -45,12 +44,11 @@ public class RobotInfoDao extends ServiceImpl<RobotInfoMapper, RobotInfo> {
|
|||||||
/**
|
/**
|
||||||
* 查询机器人目前所有运行中的机器人
|
* 查询机器人目前所有运行中的机器人
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<RobotInfo> queryRunningRobotList() {
|
public List<RobotInfo> queryRunningRobotList() {
|
||||||
List<RobotInfo> pageOfRobotInfo = lambdaQuery().eq(RobotInfo::getIsDelete, 0)
|
List<RobotInfo> pageOfRobotInfo = lambdaQuery().eq(RobotInfo::getIsDelete, 0)
|
||||||
.eq(RobotInfo::getStatus, RobotStatus.ENABLED.getCode())
|
.eq(RobotInfo::getStatus, RobotStatusEnum.ENABLED.getCode())
|
||||||
.orderByDesc(RobotInfo::getUpdateAt).list();
|
.orderByDesc(RobotInfo::getUpdateAt).list();
|
||||||
return pageOfRobotInfo;
|
return pageOfRobotInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* im
|
* im
|
||||||
*
|
*
|
||||||
@ -36,6 +38,18 @@ public class RobotTagDao extends ServiceImpl<RobotTagMapper, RobotTag> {
|
|||||||
return pageOfRobotTag;
|
return pageOfRobotTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询机器人标签列表
|
||||||
|
*
|
||||||
|
* @param ids 机器人tagId列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<RobotTag> queryRobotTagList(List<Long> ids) {
|
||||||
|
List<RobotTag> robotTagList = lambdaQuery().eq(RobotTag::getIsDelete, 0)
|
||||||
|
.in(RobotTag::getId, ids).list();
|
||||||
|
return robotTagList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存机器人标签
|
* 保存机器人标签
|
||||||
*
|
*
|
||||||
@ -47,4 +61,5 @@ public class RobotTagDao extends ServiceImpl<RobotTagMapper, RobotTag> {
|
|||||||
return robotTag;
|
return robotTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package cn.axzo.im.entity;
|
|||||||
import cn.axzo.framework.data.mybatisplus.model.BaseEntity;
|
import cn.axzo.framework.data.mybatisplus.model.BaseEntity;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@ -19,10 +20,11 @@ import java.util.List;
|
|||||||
* @author zuoqinbo
|
* @author zuoqinbo
|
||||||
* @date 2023/10/9 16:01
|
* @date 2023/10/9 16:01
|
||||||
*/
|
*/
|
||||||
@TableName("im_robot_info")
|
@TableName(value = "im_robot_info",autoResultMap = true)
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
|
|
||||||
public class RobotInfo extends BaseEntity<RobotInfo> implements Serializable {
|
public class RobotInfo extends BaseEntity<RobotInfo> implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@ -44,8 +46,8 @@ public class RobotInfo extends BaseEntity<RobotInfo> implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 机器人Tag列表
|
* 机器人Tag列表
|
||||||
*/
|
*/
|
||||||
@TableField("tag_name_list")
|
@TableField(value = "tag_name_list",typeHandler = JacksonTypeHandler.class)
|
||||||
private List<String> tagNameList;
|
private List<Long> tagNameList;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,9 +64,9 @@ public class RobotInfo extends BaseEntity<RobotInfo> implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 机器人状态
|
* 机器人状态
|
||||||
* @see cn.axzo.im.enums.RobotStatus
|
* @see cn.axzo.im.center.common.enums.RobotStatusEnum
|
||||||
*/
|
*/
|
||||||
@TableField("status")
|
@TableField("status")
|
||||||
private Integer status;
|
private String status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,30 +0,0 @@
|
|||||||
package cn.axzo.im.enums;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 机器人状态
|
|
||||||
*
|
|
||||||
* @version V1.0
|
|
||||||
* @author zuoqinbo
|
|
||||||
* @date 2023/10/9 16:01
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
public enum RobotStatus {
|
|
||||||
|
|
||||||
CREATING("creating", "待生成IM账号"),
|
|
||||||
UN_ENABLE("un_enable", "待启用"),
|
|
||||||
ENABLED("enabled", "运行中"),
|
|
||||||
DISABLED("disabled", "已停用");
|
|
||||||
|
|
||||||
private String code;
|
|
||||||
|
|
||||||
private String message;
|
|
||||||
|
|
||||||
RobotStatus(String code, String message) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -18,6 +18,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@ -44,6 +45,9 @@ public class AccountService {
|
|||||||
@Resource
|
@Resource
|
||||||
private AccountRegisterDao accountRegisterDao;
|
private AccountRegisterDao accountRegisterDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RobotInfoService robotInfoService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建IM账户
|
* 创建IM账户
|
||||||
*
|
*
|
||||||
@ -65,11 +69,15 @@ public class AccountService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public UserAccountResp generateRobotAccount(@Valid RobotAccountReq robotAccountReq) {
|
public UserAccountResp generateRobotAccount(@Valid RobotAccountReq robotAccountReq) {
|
||||||
//后续AppKey可能会更换,机器人通过robotId、appKey维度来保证唯一性
|
//后续AppKey可能会更换,机器人通过robotId、appKey维度来保证唯一性
|
||||||
String robotId = robotAccountReq.getRobotId();
|
String robotId = robotAccountReq.getRobotId();
|
||||||
UserAccountResp userAccountResp = createAccountRegister(robotId, robotId, AppTypeEnum.SYSTEM.getCode(),
|
String robotIdWrapper = robotId + "_" + AppTypeEnum.SYSTEM.getCode();
|
||||||
|
UserAccountResp userAccountResp = createAccountRegister(robotId, robotIdWrapper, AppTypeEnum.SYSTEM.getCode(),
|
||||||
AccountTypeEnum.ROBOT.getCode(), robotAccountReq.getHeadImageUrl(), robotAccountReq.getNickName());
|
AccountTypeEnum.ROBOT.getCode(), robotAccountReq.getHeadImageUrl(), robotAccountReq.getNickName());
|
||||||
|
//生成后更新机器人信息表
|
||||||
|
robotInfoService.updateRobotStatus(robotId, userAccountResp.getImAccount());
|
||||||
return userAccountResp;
|
return userAccountResp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,26 +1,32 @@
|
|||||||
package cn.axzo.im.service;
|
package cn.axzo.im.service;
|
||||||
|
|
||||||
import cn.axzo.basics.common.BeanMapper;
|
import cn.axzo.basics.common.BeanMapper;
|
||||||
|
import cn.axzo.basics.common.exception.ServiceException;
|
||||||
import cn.axzo.framework.domain.page.PageResp;
|
import cn.axzo.framework.domain.page.PageResp;
|
||||||
import cn.axzo.im.center.api.vo.req.RobotInfoReq;
|
import cn.axzo.im.center.api.vo.req.RobotInfoReq;
|
||||||
import cn.axzo.im.center.api.vo.req.RobotPageQuery;
|
import cn.axzo.im.center.api.vo.req.RobotPageQuery;
|
||||||
import cn.axzo.im.center.api.vo.req.UpdateRobotInfoReq;
|
import cn.axzo.im.center.api.vo.req.UpdateRobotInfoReq;
|
||||||
import cn.axzo.im.center.api.vo.resp.RobotInfoResp;
|
import cn.axzo.im.center.api.vo.resp.RobotInfoResp;
|
||||||
import cn.axzo.im.center.api.vo.resp.RobotMsgTemplateResp;
|
import cn.axzo.im.center.api.vo.resp.RobotMsgTemplateResp;
|
||||||
|
import cn.axzo.im.center.api.vo.resp.RobotTagResp;
|
||||||
|
import cn.axzo.im.center.common.enums.RobotStatusEnum;
|
||||||
import cn.axzo.im.dao.repository.RobotInfoDao;
|
import cn.axzo.im.dao.repository.RobotInfoDao;
|
||||||
import cn.axzo.im.dao.repository.RobotInfoDao;
|
import cn.axzo.im.dao.repository.RobotTagDao;
|
||||||
import cn.axzo.im.entity.RobotInfo;
|
import cn.axzo.im.entity.RobotInfo;
|
||||||
|
import cn.axzo.im.entity.RobotTag;
|
||||||
import cn.axzo.im.utils.BeanConvertUtils;
|
import cn.axzo.im.utils.BeanConvertUtils;
|
||||||
import cn.azxo.framework.common.model.CommonResponse;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* im
|
* im
|
||||||
@ -37,36 +43,83 @@ public class RobotInfoService {
|
|||||||
@Resource
|
@Resource
|
||||||
private RobotInfoDao robotInfoDao;
|
private RobotInfoDao robotInfoDao;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RobotTagDao robotTagDao;
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public RobotInfoResp saveRobotInfo(@Valid RobotInfoReq robotInfoRequest) {
|
public RobotInfoResp saveRobotInfo(@Valid RobotInfoReq robotInfoRequest) {
|
||||||
|
verifyRobotName(robotInfoRequest.getNickName(), null);
|
||||||
RobotInfo robotInfo = BeanConvertUtils.copyBean(robotInfoRequest, RobotInfo.class);
|
RobotInfo robotInfo = BeanConvertUtils.copyBean(robotInfoRequest, RobotInfo.class);
|
||||||
|
String robotId = UUID.randomUUID().toString();
|
||||||
|
robotInfo.setRobotId(robotId);
|
||||||
|
robotInfo.setCreateAt(new Date());
|
||||||
|
robotInfo.setUpdateAt(new Date());
|
||||||
robotInfo = robotInfoDao.saveOrUpdateRobotInfo(robotInfo);
|
robotInfo = robotInfoDao.saveOrUpdateRobotInfo(robotInfo);
|
||||||
if (robotInfo != null) {
|
if (robotInfo != null) {
|
||||||
RobotInfoResp robotInfoResp = BeanMapper.map(robotInfo, RobotInfoResp.class);
|
return findRobotInfoById(robotInfo.getId());
|
||||||
return robotInfoResp;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public RobotInfoResp updateRobotInfo(@Valid UpdateRobotInfoReq updateRobotInfoReq) {
|
|
||||||
RobotInfo robotInfo = BeanConvertUtils.copyBean(updateRobotInfoReq, RobotInfo.class);
|
|
||||||
robotInfo = robotInfoDao.saveOrUpdateRobotInfo(robotInfo);
|
|
||||||
if (robotInfo != null) {
|
|
||||||
RobotInfoResp robotInfoResp = BeanMapper.map(robotInfo, RobotInfoResp.class);
|
|
||||||
return robotInfoResp;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RobotInfoResp queryRobotInfo(Long robotInfoId) {
|
@Transactional(rollbackFor = Exception.class)
|
||||||
RobotInfo robotInfo = robotInfoDao.getById(robotInfoId);
|
public RobotInfoResp updateRobotInfo(@Valid UpdateRobotInfoReq updateRobotInfoReq) {
|
||||||
|
String status = updateRobotInfoReq.getStatus();
|
||||||
|
Long primaryId = updateRobotInfoReq.getId();
|
||||||
|
RobotInfo robotTag = robotInfoDao.lambdaQuery().eq(RobotInfo::getIsDelete, 0)
|
||||||
|
.eq(RobotInfo::getId, primaryId).one();
|
||||||
|
if (robotTag == null) {
|
||||||
|
throw new ServiceException("机器人主键ID=[" + primaryId + "]的查询不到有效数据!无法进行更新");
|
||||||
|
}
|
||||||
|
verifyRobotName(updateRobotInfoReq.getNickName(), primaryId);
|
||||||
|
verifyRobotStatus(updateRobotInfoReq.getStatus(), primaryId);
|
||||||
|
|
||||||
|
RobotInfo robotInfo = BeanConvertUtils.copyBean(updateRobotInfoReq, RobotInfo.class);
|
||||||
|
robotInfo.setUpdateAt(new Date());
|
||||||
|
robotInfo = robotInfoDao.saveOrUpdateRobotInfo(robotInfo);
|
||||||
if (robotInfo != null) {
|
if (robotInfo != null) {
|
||||||
RobotInfoResp robotInfoResp = BeanMapper.map(robotInfo, RobotInfoResp.class);
|
return findRobotInfoById(robotInfo.getId());
|
||||||
return robotInfoResp;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void verifyRobotStatus(String status, Long primaryId) {
|
||||||
|
RobotStatusEnum appTypeEnum = RobotStatusEnum.isValidRobotStatus(status);
|
||||||
|
if (appTypeEnum == null) {
|
||||||
|
throw new ServiceException("服务器不支持该状态status[" + status + "]!");
|
||||||
|
}
|
||||||
|
//只有是待生成账户状态时,imAccount才能是空,要做其他状态操作,必须有IM账户
|
||||||
|
RobotInfo robotTag = robotInfoDao.lambdaQuery().eq(RobotInfo::getIsDelete, 0)
|
||||||
|
.eq(RobotInfo::getId, primaryId).one();
|
||||||
|
if (!appTypeEnum.getCode().equals(RobotStatusEnum.CREATING.getCode()) &&
|
||||||
|
StringUtils.isBlank(robotTag.getImAccount())) {
|
||||||
|
throw new ServiceException("机器人未生成IM账户,无法进行状态更新");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verifyRobotName(String nickName, Long currentId) {
|
||||||
|
RobotInfo nickNameVerify = robotInfoDao.lambdaQuery().eq(RobotInfo::getIsDelete, 0)
|
||||||
|
.eq(RobotInfo::getNickName, nickName).one();
|
||||||
|
if (nickNameVerify != null && !nickNameVerify.getId().equals(currentId)) {
|
||||||
|
throw new ServiceException("机器人名称=[" + nickName + "]重复!无法进行保存");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private RobotInfoResp findRobotInfoById(Long id) {
|
||||||
|
RobotInfo robotInfo = robotInfoDao.getById(id);
|
||||||
|
List<Long> tagIdList = robotInfo.getTagNameList();
|
||||||
|
RobotInfoResp robotInfoResp = BeanMapper.map(robotInfo, RobotInfoResp.class);
|
||||||
|
List<RobotTag> robotTags = robotTagDao.queryRobotTagList(tagIdList);
|
||||||
|
List<RobotTagResp> robotTagsResp = BeanMapper.copyList(robotTags, RobotTagResp.class);
|
||||||
|
robotInfoResp.setRobotTagList(robotTagsResp);
|
||||||
|
return robotInfoResp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RobotInfoResp queryRobotInfo(Long robotInfoId) {
|
||||||
|
return findRobotInfoById(robotInfoId);
|
||||||
|
}
|
||||||
|
|
||||||
public PageResp<RobotInfoResp> queryRobotInfoList(RobotPageQuery robotInfoQuery) {
|
public PageResp<RobotInfoResp> queryRobotInfoList(RobotPageQuery robotInfoQuery) {
|
||||||
IPage<RobotInfo> robotInfoIPage = robotInfoDao.queryRobotInfoOfPage(robotInfoQuery);
|
IPage<RobotInfo> robotInfoIPage = robotInfoDao.queryRobotInfoOfPage(robotInfoQuery);
|
||||||
List<RobotInfoResp> list = BeanMapper.copyList(robotInfoIPage.getRecords(), RobotInfoResp.class);
|
List<RobotInfoResp> list = BeanMapper.copyList(robotInfoIPage.getRecords(), RobotInfoResp.class);
|
||||||
@ -80,4 +133,12 @@ public class RobotInfoService {
|
|||||||
List<RobotMsgTemplateResp> msgTemplateResps = BeanMapper.copyList(runningRobots, RobotMsgTemplateResp.class);
|
List<RobotMsgTemplateResp> msgTemplateResps = BeanMapper.copyList(runningRobots, RobotMsgTemplateResp.class);
|
||||||
return msgTemplateResps;
|
return msgTemplateResps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateRobotStatus(String robotId, String imAccount) {
|
||||||
|
RobotInfo robotInfo = robotInfoDao.lambdaQuery().eq(RobotInfo::getIsDelete, 0)
|
||||||
|
.eq(RobotInfo::getRobotId, robotId).one();
|
||||||
|
robotInfo.setImAccount(imAccount);
|
||||||
|
robotInfo.setStatus(RobotStatusEnum.UN_ENABLE.getCode());
|
||||||
|
robotInfoDao.saveOrUpdateRobotInfo(robotInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,25 +1,28 @@
|
|||||||
package cn.axzo.im.service;
|
package cn.axzo.im.service;
|
||||||
|
|
||||||
import cn.axzo.basics.common.BeanMapper;
|
import cn.axzo.basics.common.BeanMapper;
|
||||||
|
import cn.axzo.basics.common.exception.ServiceException;
|
||||||
import cn.axzo.framework.domain.page.PageResp;
|
import cn.axzo.framework.domain.page.PageResp;
|
||||||
import cn.axzo.im.center.api.vo.req.RobotTagQuery;
|
import cn.axzo.im.center.api.vo.req.RobotTagQuery;
|
||||||
import cn.axzo.im.center.api.vo.req.RobotTagReq;
|
import cn.axzo.im.center.api.vo.req.RobotTagReq;
|
||||||
import cn.axzo.im.center.api.vo.req.UpdateRobotTagReq;
|
import cn.axzo.im.center.api.vo.req.UpdateRobotTagReq;
|
||||||
import cn.axzo.im.center.api.vo.resp.RobotTagResp;
|
import cn.axzo.im.center.api.vo.resp.RobotTagResp;
|
||||||
|
import cn.axzo.im.center.common.enums.RobotStatusEnum;
|
||||||
import cn.axzo.im.dao.repository.RobotInfoDao;
|
import cn.axzo.im.dao.repository.RobotInfoDao;
|
||||||
import cn.axzo.im.entity.RobotTag;
|
|
||||||
import cn.axzo.im.dao.repository.RobotTagDao;
|
import cn.axzo.im.dao.repository.RobotTagDao;
|
||||||
|
import cn.axzo.im.entity.RobotInfo;
|
||||||
|
import cn.axzo.im.entity.RobotTag;
|
||||||
import cn.axzo.im.utils.BeanConvertUtils;
|
import cn.axzo.im.utils.BeanConvertUtils;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机器人标签服务
|
* 机器人标签服务
|
||||||
@ -41,7 +44,15 @@ public class RobotTagService {
|
|||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public RobotTagResp saveRobotTag(@Valid RobotTagReq robotTagRequest) {
|
public RobotTagResp saveRobotTag(@Valid RobotTagReq robotTagRequest) {
|
||||||
|
String tagName = robotTagRequest.getTagName();
|
||||||
|
RobotTag tagNameVerify = robotTagDao.lambdaQuery().eq(RobotTag::getIsDelete, 0)
|
||||||
|
.eq(RobotTag::getTagName, tagName).one();
|
||||||
|
if (tagNameVerify != null) {
|
||||||
|
throw new ServiceException("标签名称=[" + tagName + "]重复!无法进行保存");
|
||||||
|
}
|
||||||
RobotTag robotTag = BeanConvertUtils.copyBean(robotTagRequest, RobotTag.class);
|
RobotTag robotTag = BeanConvertUtils.copyBean(robotTagRequest, RobotTag.class);
|
||||||
|
robotTag.setCreateAt(new Date());
|
||||||
|
robotTag.setUpdateAt(new Date());
|
||||||
robotTag = robotTagDao.saveOrUpdateRobotTag(robotTag);
|
robotTag = robotTagDao.saveOrUpdateRobotTag(robotTag);
|
||||||
if (robotTag != null) {
|
if (robotTag != null) {
|
||||||
RobotTagResp robotTagResp = BeanMapper.map(robotTag, RobotTagResp.class);
|
RobotTagResp robotTagResp = BeanMapper.map(robotTag, RobotTagResp.class);
|
||||||
@ -52,9 +63,23 @@ public class RobotTagService {
|
|||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public RobotTagResp updateRobotTag(@Valid UpdateRobotTagReq updateRobotTagReq) {
|
public RobotTagResp updateRobotTag(@Valid UpdateRobotTagReq updateRobotTagReq) {
|
||||||
RobotTag robotTag = BeanConvertUtils.copyBean(updateRobotTagReq, RobotTag.class);
|
Long tagId = updateRobotTagReq.getId();
|
||||||
|
String tagName = updateRobotTagReq.getTagName();
|
||||||
|
RobotTag robotTag = robotTagDao.lambdaQuery().eq(RobotTag::getIsDelete, 0)
|
||||||
|
.eq(RobotTag::getId, tagId).one();
|
||||||
|
if (robotTag == null) {
|
||||||
|
throw new ServiceException("标签ID=[" + tagId + "]的查询不到有效数据!无法进行更新");
|
||||||
|
}
|
||||||
|
RobotTag tagNameVerify = robotTagDao.lambdaQuery().eq(RobotTag::getIsDelete, 0)
|
||||||
|
.eq(RobotTag::getTagName, tagName).one();
|
||||||
|
if (tagNameVerify != null && !tagNameVerify.getId().equals(tagId)) {
|
||||||
|
throw new ServiceException("标签名称=[" + tagName + "]重复!无法进行更新");
|
||||||
|
}
|
||||||
|
robotTag = BeanConvertUtils.copyBean(updateRobotTagReq, RobotTag.class);
|
||||||
|
robotTag.setUpdateAt(new Date());
|
||||||
robotTag = robotTagDao.saveOrUpdateRobotTag(robotTag);
|
robotTag = robotTagDao.saveOrUpdateRobotTag(robotTag);
|
||||||
if (robotTag != null) {
|
if (robotTag != null) {
|
||||||
|
robotTag = robotTagDao.getById(updateRobotTagReq.getId());
|
||||||
RobotTagResp robotTagResp = BeanMapper.map(robotTag, RobotTagResp.class);
|
RobotTagResp robotTagResp = BeanMapper.map(robotTag, RobotTagResp.class);
|
||||||
return robotTagResp;
|
return robotTagResp;
|
||||||
}
|
}
|
||||||
@ -62,7 +87,8 @@ public class RobotTagService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public RobotTagResp queryRobotTagInfo(Long robotTagId) {
|
public RobotTagResp queryRobotTagInfo(Long robotTagId) {
|
||||||
RobotTag robotTag = robotTagDao.getById(robotTagId);
|
RobotTag robotTag = robotTagDao.lambdaQuery().eq(RobotTag::getIsDelete, 0)
|
||||||
|
.eq(RobotTag::getId, robotTagId).one();
|
||||||
if (robotTag != null) {
|
if (robotTag != null) {
|
||||||
RobotTagResp robotTagResp = BeanMapper.map(robotTag, RobotTagResp.class);
|
RobotTagResp robotTagResp = BeanMapper.map(robotTag, RobotTagResp.class);
|
||||||
return robotTagResp;
|
return robotTagResp;
|
||||||
@ -77,4 +103,11 @@ public class RobotTagService {
|
|||||||
robotTagIPage.getTotal(), list);
|
robotTagIPage.getTotal(), list);
|
||||||
return pageOfRobotTagResp;
|
return pageOfRobotTagResp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<RobotTagResp> queryRobotTagValidList() {
|
||||||
|
List<RobotTag> robotTagList = robotTagDao.lambdaQuery().eq(RobotTag::getIsDelete, 0)
|
||||||
|
.in(RobotTag::getStatus, 1).list();
|
||||||
|
List<RobotTagResp> robotTagsResp = BeanMapper.copyList(robotTagList, RobotTagResp.class);
|
||||||
|
return robotTagsResp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
18
sql/init.sql
18
sql/init.sql
@ -1,9 +1,9 @@
|
|||||||
CREATE TABLE IF NOT EXISTS im_robot_tag
|
CREATE TABLE IF NOT EXISTS im_robot_tag
|
||||||
(
|
(
|
||||||
id bigint auto_increment comment '主键',
|
id bigint auto_increment comment '主键',
|
||||||
tag_name varchar(100) not null comment '机器人Tag名称' unique,
|
tag_name varchar(100) not null comment '机器人Tag名称',
|
||||||
weight int default 1 not null comment '机器人Tag排序权重,最小值是1',
|
weight int default 1 not null comment '机器人Tag排序权重,最小值是1',
|
||||||
status tinyint default 1 not null comment '机器人Tag状态 1、开启、0关闭',
|
status tinyint default 1 not null comment '机器人Tag状态 1:上架、0:下架',
|
||||||
color varchar(10) default '' not null comment '机器人Tag颜色',
|
color varchar(10) default '' not null comment '机器人Tag颜色',
|
||||||
is_delete tinyint default 0 not null comment '未删除0,删除id',
|
is_delete tinyint default 0 not null comment '未删除0,删除id',
|
||||||
create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||||
@ -18,8 +18,9 @@ CREATE TABLE IF NOT EXISTS im_robot_info
|
|||||||
(
|
(
|
||||||
id bigint auto_increment comment '主键',
|
id bigint auto_increment comment '主键',
|
||||||
robot_id varchar(100) not null comment '机器人ID' unique,
|
robot_id varchar(100) not null comment '机器人ID' unique,
|
||||||
nick_name varchar(100) not null comment '机器人名称' unique,
|
nick_name varchar(100) not null comment '机器人名称',
|
||||||
status varchar(50) default '' not null comment '机器人状态',
|
status varchar(50) default '' not null comment '机器人状态:待生成IM账号、待启用、运行中、已停用',
|
||||||
|
tag_name_list varchar(50) default '' not null comment '机器人关联标签列表',
|
||||||
head_image_url varchar(512) default '' not null comment '机器人头像url',
|
head_image_url varchar(512) default '' not null comment '机器人头像url',
|
||||||
im_account varchar(100) default '' not null comment '机器人IM账号',
|
im_account varchar(100) default '' not null comment '机器人IM账号',
|
||||||
is_delete tinyint default 0 not null comment '未删除0,删除id',
|
is_delete tinyint default 0 not null comment '未删除0,删除id',
|
||||||
@ -39,13 +40,12 @@ CREATE TABLE IF NOT EXISTS im_account_register
|
|||||||
(
|
(
|
||||||
id bigint auto_increment comment '主键',
|
id bigint auto_increment comment '主键',
|
||||||
account_id varchar(100) not null comment '用户账户:机器人robotId、普通用户userId',
|
account_id varchar(100) not null comment '用户账户:机器人robotId、普通用户userId',
|
||||||
account_wrapper varchar(100) not null comment '普通用户,通过appType包装',
|
account_wrapper varchar(100) not null comment '普通用户账户,通过appType包装',
|
||||||
app_key varchar(100) not null comment '网易云信app_key',
|
app_key varchar(100) not null comment '网易云信app_key',
|
||||||
im_account varchar(100) default '' not null comment '机器人IM账号',
|
im_account varchar(100) default '' not null comment '已生成IM账号',
|
||||||
account_type varchar(20) default '' not null comment '账户类型:机器人、普通用户',
|
account_type varchar(20) default '' not null comment '账户类型:机器人、普通用户',
|
||||||
app_type varchar(20) default '' not null comment 'App终端类型:WORKER、ENTERPRISE、SYSTEM',
|
app_type varchar(20) default '' not null comment 'App终端类型:WORKER、ENTERPRISE、SYSTEM',
|
||||||
token varchar(100) default '' not null comment '网易云信token',
|
token varchar(100) default '' not null comment '网易云信静态token',
|
||||||
|
|
||||||
is_delete tinyint default 0 not null comment '未删除0,删除id',
|
is_delete tinyint default 0 not null comment '未删除0,删除id',
|
||||||
create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||||
update_at datetime default CURRENT_TIMESTAMP not null comment '更新时间',
|
update_at datetime default CURRENT_TIMESTAMP not null comment '更新时间',
|
||||||
@ -55,5 +55,5 @@ CREATE TABLE IF NOT EXISTS im_account_register
|
|||||||
|
|
||||||
create index idx_im_account_id
|
create index idx_im_account_id
|
||||||
on im_account_register (account_id);
|
on im_account_register (account_id);
|
||||||
create index idx_im_account_register_id
|
create index idx_im_register_id
|
||||||
on im_account_register (im_account);
|
on im_account_register (im_account);
|
||||||
Loading…
Reference in New Issue
Block a user