完成Bot的注册与配置
This commit is contained in:
parent
1a1df9f493
commit
149e5c274f
|
|
@ -1,5 +1,6 @@
|
|||
package com.gitlink.softbot.service.user.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.gitlink.softbot.dao.db.BotLimitMapper;
|
||||
import com.gitlink.softbot.dao.db.BotMapper;
|
||||
|
|
@ -14,6 +15,7 @@ import com.gitlink.softbot.service.user.AbstractUserBot;
|
|||
import com.gitlink.softbot.service.user.IUserService;
|
||||
import com.gitlink.softbot.vo.BotInputVO;
|
||||
import com.gitlink.softbot.vo.BotOutputVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -25,6 +27,7 @@ import java.util.List;
|
|||
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class UserService extends AbstractUserBot implements IUserService {
|
||||
|
||||
@Autowired
|
||||
|
|
@ -39,6 +42,7 @@ public class UserService extends AbstractUserBot implements IUserService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BotOutputVO registerBot(BotInputVO botVO) throws BotException {
|
||||
log.info("开始注册Bot{}", JSON.toJSONString(botVO));
|
||||
//校验必填信息信息
|
||||
checkInfo(botVO);
|
||||
//插入Bot表
|
||||
|
|
@ -59,13 +63,14 @@ public class UserService extends AbstractUserBot implements IUserService {
|
|||
//插入注册表
|
||||
RegisterBot registerBot = shiftBotToRegisterBot(botVO,insertBot);
|
||||
registerMapper.insert(registerBot);
|
||||
|
||||
log.info("注册Bot结束{}",JSON.toJSONString(shiftBotToBotOutputVo(botVO,insertBot)));
|
||||
return shiftBotToBotOutputVo(botVO,insertBot);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BotOutputVO updateBot(BotInputVO botInputVO) throws BotException {
|
||||
log.info("开始配置Bot{}",JSON.toJSONString(botInputVO));
|
||||
//先更新Bot
|
||||
Bot updateBot = shiftObject(botInputVO);
|
||||
Integer id = botMapper.selectOne(new QueryWrapper<Bot>().eq("bot_name",botInputVO.getBotName())).getId();
|
||||
|
|
@ -130,6 +135,7 @@ public class UserService extends AbstractUserBot implements IUserService {
|
|||
botLimitMapper.insert(botLimitEvent);
|
||||
}
|
||||
}
|
||||
log.info("结束配置Bot{}",JSON.toJSONString(shiftBotToBotOutputVo(botInputVO,updateBot)));
|
||||
return shiftBotToBotOutputVo(botInputVO,updateBot);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue